Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Version:
  $Revision: 1.58 $ $Date: 2000/03/31 16:05:04 $
See Also:
  Serialized Form

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
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, 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:
  - No `port` parameter is specified in the `jserv.properties`
  - Value specified is outside the valid range (1024-65535). The lower one is the minimum allowed for non-root listening socket, the upper one is imposed by the operating system limitations. The latter restriction may be lifted in the future (there are UNIX flavors which already don't have it).
  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 JServLog log

### pool

    protected static WorkerPool pool

### listenSocket

    private static java.net.ServerSocket listenSocket

### table

    private static java.util.Hashtable table

### semaphore

    private static Semaphore semaphore

### confFile

    static java.lang.String confFile

### SINGLE_COLUMN

    private static final java.lang.String SINGLE_COLUMN

### STATUS_SERVLET

    private static final java.lang.String STATUS_SERVLET

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.

### welcome

    private static void welcome()

  Prints the welcome message on standard output. This is seen only from manual operation. This method is called from main.

### usage

    private static void usage()

  Prints the help on usage message on standard error. This method is called from main.

### start

    static void start()

  Read the host configuration property file and perform all the specified actions. This method is called from main.

### clear

    protected static void clear()

  Clears JServ and prepare it for restart of termination

### bindTo

    private static java.net.InetAddress bindTo(java.lang.String HostName)

  returns the InetAddress this JServ is binding to read from properties file.

### 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.

### signal

    private static void signal(java.lang.String signal)

  Signal a running 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.

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

### sendHead

    private void sendHead(javax.servlet.ServletOutputStream out)
                   throws java.io.IOException

### sendTail

    private void sendTail(javax.servlet.ServletOutputStream out)
                   throws java.io.IOException

### showMenu

    private void showMenu(javax.servlet.ServletOutputStream out)
                   throws java.io.IOException

### handleStatus

    private void handleStatus(javax.servlet.ServletOutputStream out,
                              java.lang.String query)
                       throws java.io.IOException

### handleZones

    private void handleZones(javax.servlet.ServletOutputStream out,
                             java.lang.String query)
                      throws java.io.IOException

### writeTable

    private void writeTable(javax.servlet.ServletOutputStream out,
                            java.lang.String name,
                            java.util.Hashtable table,
                            java.lang.String[] rowColors)
                     throws java.io.IOException

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD