Enhydra 5.1 API

org.enhydra.servlet
Class ServletContainer

java.lang.Object
  |
  +--org.enhydra.servlet.ServletContainer
All Implemented Interfaces:
Service

public class ServletContainer
extends java.lang.Object
implements Service

Handles requests for Servlets. Multiple connection methods may be routed to one Servlet, or one connection method may direct requests to multiple Servlets (based on URL).

Servlets or Enhydra applications (which are a special kind of servlet) or Servlet 2.2 Web applications may be served.

This class uses a ServletManager to hold a set of Servlets, a ConnectionMethodManager to hold a set of ConnectionMethods, and a FilterManager to hold a set of Filters. These are available to other classes (for example the admin application).

At startup time a configuration file is read, and it describes what ConnectionMethods to create, what Servlets to register, and the connections to make from the ConnectionMethods to the Servlets. It also describes the filters to create and what channels to install them in. These filters are all descendants of the MultServerFilter class.

After this config file is read, and the servlet container is set up, no further action is taken. The thread that ran through start() exits. The ConnectionMethods must create threads, and they are responsible for receiving requests from the outside world and passing them on to the handleRequest() methods of the ServletContainer.

Normally one of the Servlets will be an administration application. This admin app knows about this class, and so it knows how to talk to the current ConnectionMethods and Servlets. It may change the server setup on the fly. For example, it can create and add a new ConnectionMethod. Or it could add a new channel to an already existing ConnectionMethod. Or register a new Servlet. Or add a logging filter to a channel. Or monitor performance.

Author:
Shawn McMurdo
, Andy John
See Also:
org.enhydra.servlet.connectionMethod.ConnectionMethod, org.enhydra.servlet.connectionMethod.ConnectionMethodManager, FilterManager, ServletManager, Filter, Servlet

Field Summary
static java.lang.String APACHE
           
static java.lang.String APP_CLASS
           
static java.lang.String APPLICATION
           
static java.lang.String AUTO_RELOAD
           
static java.lang.String CGI
           
static java.lang.String CHANNEL
           
static java.lang.String CLASS_NAME
           
static java.lang.String CLASS_PATH
           
static java.lang.String CLIENT_AUTHENTICATION
           
static java.lang.String CONF_DIR
           
static java.lang.String CONF_FILE
           
 Config config
           
static java.lang.String CONNECTION
           
static java.lang.String DEFAULT_SESSION_TIMEOUT
           
static java.lang.String DESCRIPTION
           
static java.lang.String DOC_ROOT
           
static java.lang.String ENABLED
           
static java.lang.String ENYHDRA_APP_CLASSNAME
           
static java.lang.String FILTER
           
static java.lang.String FILTERS
           
static java.lang.String FULL
           
static java.lang.String HTTP
           
static java.lang.String HTTPS
           
static java.lang.String INIT_ARGS
           
static java.lang.String IS_INVOKER_ENABLED
           
static java.lang.String IS_WAR_EXPANDED
           
static java.lang.String IS_WAR_VALIDATED
           
static java.lang.String IS_WORKDIR_PERSISTENT
           
static java.lang.String KEY_MANAGER_ALGORITHM
           
static java.lang.String KEY_MANAGER_PROVIDER
           
static java.lang.String KEY_STORE_LOCATION
           
static java.lang.String KEY_STORE_PROVIDER
           
protected static org.apache.log4j.Logger loggerSys
          The logger that logs on System.out.
static java.lang.String NO
           
static java.lang.String NONE
           
static java.lang.String PASSWORD
           
static java.lang.String PRESENTATION_PREFIX
           
static java.lang.String RMI
           
static java.lang.String RUNNING
           
static java.lang.String SECURE_RANDOM_ALGORITHM
           
static java.lang.String SECURE_RANDOM_PROVIDER
           
static java.lang.String SERVER
           
static java.lang.String SERVER_CERTIFICATE
           
static java.lang.String SERVLET
           
static java.lang.String SESSION_MANAGER
           
static java.lang.String SSL
           
static java.lang.String SSL_CONTEXT_PROTOCOL
           
static java.lang.String SSL_CONTEXT_PROVIDER
           
static java.lang.String TRUST_MANAGER
           
static java.lang.String URL
           
static java.lang.String WAI
           
static java.lang.String YES
           
 
Constructor Summary
ServletContainer()
          Default constructor.
 
Method Summary
 java.lang.String getConfigDirectory()
          Get the config directory used by this ServletContainer to find apps.
 ConnectionMethodManager getConnectionMethodManager()
          Get the connection manager for the ServletContainer.
 FilterManager getFilterManager()
          Get the filter manager for the ServletContainer.
 ServletManager getServletManager()
          Get the servlet manager for the ServletContainer.
 SessionManager getSessionManager()
          Get the servlet manager for the ServletContainer.
 void init()
          Default initialization.
 void init(java.lang.String configFileName)
          Initialization uses the passed in config file.
 void start()
          Start the servlet container.
 void stop()
          Stop the servlet container.
 java.lang.String writeConfigFile(java.lang.String filename)
          This function examines the current state of the server and writes it out to the given config file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

public Config config

loggerSys

protected static org.apache.log4j.Logger loggerSys
The logger that logs on System.out.


CONF_DIR

public static final java.lang.String CONF_DIR
See Also:
Constant Field Values

SERVER

public static final java.lang.String SERVER
See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
See Also:
Constant Field Values

CONF_FILE

public static final java.lang.String CONF_FILE
See Also:
Constant Field Values

SERVLET

public static final java.lang.String SERVLET
See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values

DOC_ROOT

public static final java.lang.String DOC_ROOT
See Also:
Constant Field Values

DESCRIPTION

public static final java.lang.String DESCRIPTION
See Also:
Constant Field Values

RUNNING

public static final java.lang.String RUNNING
See Also:
Constant Field Values

CLASS_PATH

public static final java.lang.String CLASS_PATH
See Also:
Constant Field Values

INIT_ARGS

public static final java.lang.String INIT_ARGS
See Also:
Constant Field Values

URL

public static final java.lang.String URL
See Also:
Constant Field Values

CONNECTION

public static final java.lang.String CONNECTION
See Also:
Constant Field Values

FILTERS

public static final java.lang.String FILTERS
See Also:
Constant Field Values

CHANNEL

public static final java.lang.String CHANNEL
See Also:
Constant Field Values

FILTER

public static final java.lang.String FILTER
See Also:
Constant Field Values

ENABLED

public static final java.lang.String ENABLED
See Also:
Constant Field Values

APP_CLASS

public static final java.lang.String APP_CLASS
See Also:
Constant Field Values

PRESENTATION_PREFIX

public static final java.lang.String PRESENTATION_PREFIX
See Also:
Constant Field Values

AUTO_RELOAD

public static final java.lang.String AUTO_RELOAD
See Also:
Constant Field Values

SESSION_MANAGER

public static final java.lang.String SESSION_MANAGER
See Also:
Constant Field Values

DEFAULT_SESSION_TIMEOUT

public static final java.lang.String DEFAULT_SESSION_TIMEOUT
See Also:
Constant Field Values

IS_WAR_EXPANDED

public static final java.lang.String IS_WAR_EXPANDED
See Also:
Constant Field Values

IS_WAR_VALIDATED

public static final java.lang.String IS_WAR_VALIDATED
See Also:
Constant Field Values

IS_INVOKER_ENABLED

public static final java.lang.String IS_INVOKER_ENABLED
See Also:
Constant Field Values

IS_WORKDIR_PERSISTENT

public static final java.lang.String IS_WORKDIR_PERSISTENT
See Also:
Constant Field Values

SSL

public static final java.lang.String SSL
See Also:
Constant Field Values

SERVER_CERTIFICATE

public static final java.lang.String SERVER_CERTIFICATE
See Also:
Constant Field Values

SECURE_RANDOM_ALGORITHM

public static final java.lang.String SECURE_RANDOM_ALGORITHM
See Also:
Constant Field Values

SECURE_RANDOM_PROVIDER

public static final java.lang.String SECURE_RANDOM_PROVIDER
See Also:
Constant Field Values

SSL_CONTEXT_PROVIDER

public static final java.lang.String SSL_CONTEXT_PROVIDER
See Also:
Constant Field Values

SSL_CONTEXT_PROTOCOL

public static final java.lang.String SSL_CONTEXT_PROTOCOL
See Also:
Constant Field Values

KEY_STORE_LOCATION

public static final java.lang.String KEY_STORE_LOCATION
See Also:
Constant Field Values

KEY_STORE_PROVIDER

public static final java.lang.String KEY_STORE_PROVIDER
See Also:
Constant Field Values

KEY_MANAGER_ALGORITHM

public static final java.lang.String KEY_MANAGER_ALGORITHM
See Also:
Constant Field Values

KEY_MANAGER_PROVIDER

public static final java.lang.String KEY_MANAGER_PROVIDER
See Also:
Constant Field Values

TRUST_MANAGER

public static final java.lang.String TRUST_MANAGER
See Also:
Constant Field Values

PASSWORD

public static final java.lang.String PASSWORD
See Also:
Constant Field Values

CLIENT_AUTHENTICATION

public static final java.lang.String CLIENT_AUTHENTICATION
See Also:
Constant Field Values

HTTP

public static final java.lang.String HTTP
See Also:
Constant Field Values

HTTPS

public static final java.lang.String HTTPS
See Also:
Constant Field Values

CGI

public static final java.lang.String CGI
See Also:
Constant Field Values

RMI

public static final java.lang.String RMI
See Also:
Constant Field Values

WAI

public static final java.lang.String WAI
See Also:
Constant Field Values

APACHE

public static final java.lang.String APACHE
See Also:
Constant Field Values

FULL

public static final java.lang.String FULL
See Also:
Constant Field Values

NONE

public static final java.lang.String NONE
See Also:
Constant Field Values

YES

public static final java.lang.String YES
See Also:
Constant Field Values

NO

public static final java.lang.String NO
See Also:
Constant Field Values

ENYHDRA_APP_CLASSNAME

public static final java.lang.String ENYHDRA_APP_CLASSNAME
See Also:
Constant Field Values
Constructor Detail

ServletContainer

public ServletContainer()
Default constructor.

Method Detail

init

public void init()
Default initialization. Uses the existing config file if previously set, otherwise uses the default config file.


init

public void init(java.lang.String configFileName)
Initialization uses the passed in config file.

Specified by:
init in interface Service
Parameters:
configFileName - a String filename to be read for configuration.

start

public void start()
Start the servlet container.

Specified by:
start in interface Service

stop

public void stop()
Stop the servlet container. This fucnction disables all the channels in all the connection methods, then destroys all the connection methods. This causes them to kill all their threads. When the last thread exits, the java application will exit.

Specified by:
stop in interface Service

getConnectionMethodManager

public ConnectionMethodManager getConnectionMethodManager()
Get the connection manager for the ServletContainer.

Returns:
the ConnectionMethodManager

getServletManager

public ServletManager getServletManager()
Get the servlet manager for the ServletContainer.

Returns:
the ServletManager

getSessionManager

public SessionManager getSessionManager()
Get the servlet manager for the ServletContainer.

Returns:
the ServletManager

getFilterManager

public FilterManager getFilterManager()
Get the filter manager for the ServletContainer.

Returns:
the FilterManager

getConfigDirectory

public java.lang.String getConfigDirectory()
Get the config directory used by this ServletContainer to find apps. X22 This seems like it should be in the MultiServer Admin rather X22 than here.

Returns:
a String config directory.

writeConfigFile

public java.lang.String writeConfigFile(java.lang.String filename)
This function examines the current state of the server and writes it out to the given config file.

Parameters:
filename - The filename of the config file to write out. If null, the same file that was read at startup time will be rewritten.

Enhydra 5.1 API