|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--org.apache.jserv.JServ
JServ
is the entry point to the Java part of JServ
It sets up the server, initalizes everything, and listens on a TCP port for requests for the server. When it gets a request, it launches a JServConnection thread.
Field Summary | |
static java.lang.String[] |
colors
|
(package private) static java.lang.String |
confFile
|
protected static Configurations |
confs
|
static java.lang.String |
DEFAULT_CONTROLLER
|
static int |
DEFAULT_PORT
Default port to listen to. |
private static java.net.ServerSocket |
listenSocket
|
protected static JServLog |
log
|
protected static WorkerPool |
pool
|
private static Semaphore |
semaphore
|
protected static java.util.Hashtable |
servletManagerTable
|
private static java.lang.String |
SINGLE_COLUMN
|
private static java.lang.String |
STATUS_SERVLET
|
private static java.util.Hashtable |
table
|
Fields inherited from class javax.servlet.GenericServlet |
config |
Constructor Summary | |
JServ()
|
Method Summary | |
private static java.net.InetAddress |
bindTo(java.lang.String HostName)
returns the InetAddress this JServ is binding to read from properties file. |
protected static void |
clear()
Clears JServ and prepare it for restart of termination |
protected static void |
fail(java.lang.String msg)
Exit with an error message. |
protected static void |
fail(java.lang.String msg,
java.lang.Throwable e)
Exit with an error message formatted using the exception message. |
private void |
handleStatus(javax.servlet.ServletOutputStream out,
java.lang.String query)
|
private void |
handleZones(javax.servlet.ServletOutputStream out,
java.lang.String query)
|
static void |
main(java.lang.String[] argument)
Start up JServ. |
protected static void |
restart()
Restart JServ. |
private void |
sendHead(javax.servlet.ServletOutputStream out)
|
private void |
sendTail(javax.servlet.ServletOutputStream out)
|
void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
JServ is also a servlet that returns info to the client about its status. |
private void |
showMenu(javax.servlet.ServletOutputStream out)
|
private static void |
signal(java.lang.String signal)
Signal a running JServ. |
(package private) static void |
start()
Read the host configuration property file and perform all the specified actions. |
protected static void |
terminate()
Terminate JServ. |
private static void |
usage()
Prints the help on usage message on standard error. |
static java.lang.String |
version()
|
private static void |
welcome()
Prints the welcome message on standard output. |
private void |
writeTable(javax.servlet.ServletOutputStream out,
java.lang.String name,
java.util.Hashtable table,
java.lang.String[] rowColors)
|
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete,
doGet,
doHead,
doOptions,
doPost,
doPut,
doTrace,
getAllDeclaredMethods,
getLastModified,
maybeSetLastModified,
service |
Methods inherited from class javax.servlet.GenericServlet |
destroy,
getInitParameter,
getInitParameterNames,
getServletConfig,
getServletContext,
getServletInfo,
init,
log |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int DEFAULT_PORT
port
parameter is specified in the
jserv.properties
public static final java.lang.String DEFAULT_CONTROLLER
public static final java.lang.String[] colors
protected static java.util.Hashtable servletManagerTable
protected static Configurations confs
protected static JServLog log
protected static WorkerPool pool
private static java.net.ServerSocket listenSocket
private static java.util.Hashtable table
private static Semaphore semaphore
static java.lang.String confFile
private static final java.lang.String SINGLE_COLUMN
private static final java.lang.String STATUS_SERVLET
Constructor Detail |
public JServ()
Method Detail |
public static final java.lang.String version()
public static void main(java.lang.String[] argument)
The command line usage is the following:
java org.apache.jserv.JServ configFile
arguments
- Command line parsed into strings.private static void welcome()
private static void usage()
static void start()
protected static void clear()
private static java.net.InetAddress bindTo(java.lang.String HostName)
protected static void restart()
The JVM tries to bind on the port and starts an hidden loop that consumes all the CPU and makes JServ appear burried in an infinite loop. This doesn't prevent JServ to restart gracefully, but it suddently appears dead from a network point of view and consumes all the CPU resources
Unfortunately, there is nothing we can do but wait for JVM implementors to fix this nasty bug. :-( (SM)
protected static void terminate()
private static void signal(java.lang.String signal)
protected static void fail(java.lang.String msg, java.lang.Throwable e)
protected static void fail(java.lang.String msg)
public void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
This servlet is used as installation and configuration feedback, since its correct functioning tells the user JServ is correctly working. Since this class will always be in the executing JVM's classpath, the user receive this output if Apache and JServ are setup correctly, forgetting about the servletzone configurations that may be done later on.
private void sendHead(javax.servlet.ServletOutputStream out) throws java.io.IOException
private void sendTail(javax.servlet.ServletOutputStream out) throws java.io.IOException
private void showMenu(javax.servlet.ServletOutputStream out) throws java.io.IOException
private void handleStatus(javax.servlet.ServletOutputStream out, java.lang.String query) throws java.io.IOException
private void handleZones(javax.servlet.ServletOutputStream out, java.lang.String query) throws java.io.IOException
private void writeTable(javax.servlet.ServletOutputStream out, java.lang.String name, java.util.Hashtable table, java.lang.String[] rowColors) throws java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |