org.apache.jserv
Class JServ

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.apache.jserv.JServ

public class JServ
extends javax.servlet.http.HttpServlet
implements JServLogChannels, JServDefs

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.

See Also:
Serialized Form

Field Summary
static java.lang.String[] colors
           
protected static Configurations confs
           
static java.lang.String DEFAULT_CONTROLLER
           
static int DEFAULT_PORT
          Default port to listen to.
protected static org.apache.jserv.JServLog log
           
protected static WorkerPool pool
           
protected static java.util.Hashtable servletManagerTable
           
 
Fields inherited from interface org.apache.jserv.JServLogChannels
CH_CONTAINER_EXCEPTION, CH_CRITICAL, CH_DEBUG, CH_INFO, CH_SERVLET_EXCEPTION, CH_SERVLET_LOG, CH_WARNING
 
Fields inherited from interface org.apache.jserv.JServDefs
PACKAGE, PROFILE, TURBO, VERSION
 
Constructor Summary
JServ()
           
 
Method Summary
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.
static void main(java.lang.String[] argument)
          Start up JServ.
protected static void restart()
          Restart JServ.
 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.
protected static void terminate()
          Terminate JServ.
static java.lang.String version()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
Default port to listen to. There are two cases when this value is engaged: Initialized in init.

DEFAULT_CONTROLLER

public static final java.lang.String DEFAULT_CONTROLLER

colors

public static final java.lang.String[] colors

servletManagerTable

protected static java.util.Hashtable servletManagerTable

confs

protected static Configurations confs

log

protected static org.apache.jserv.JServLog log

pool

protected static WorkerPool pool
Constructor Detail

JServ

public JServ()
Method Detail

version

public static final java.lang.String version()

main

public static void main(java.lang.String[] argument)
Start up JServ.

The command line usage is the following:

java org.apache.jserv.JServ configFile

where configurationFile if JServ configuration file.
Parameters:
arguments - Command line parsed into strings.

restart

protected static void restart()
Restart JServ. Note: due to a bug in the JavaSoft JVM on some platforms (win32), closing a server socket and rebinding to the same port produces a chain of hidden exception being thrown when the accept() method is created.

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)


terminate

protected static void terminate()
Terminate JServ.

fail

protected static void fail(java.lang.String msg,
                           java.lang.Throwable e)
Exit with an error message formatted using the exception message.

fail

protected static void fail(java.lang.String msg)
Exit with an error message.

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
JServ is also a servlet that returns info to the client about its status. Security checks are performed by the Apache side but we have the chance to disable this behavior from this side, too.

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.

Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException - when servlet request fails