All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.apache.jserv.JServServletManager

java.lang.Object
   |
   +----org.apache.jserv.JServServletManager

public class JServServletManager
extends Object
implements HttpSessionContext, JServDebug. DebugConstants
Class that encapsulates the loading and managing of servlets per virtual server.

Configuration options taken from system properties :

Note about synchronization :

All the method that modifies the servlet table are synchronized on the JServServletManager. Since this table is private there no needs to synchronized on it anymore.

Version:
$Revision: 1.8 $ $Date: 1998/02/11 23:46:15 $
Author:
Alexei Kosut, Francis J. Lacoste, Martin Pool

Variable Index

 o defaultArgs
The default init arguments for all the servlet in this name space.
 o lastInitialization
The time of the last initialization.
 o loader
The class loader used for loading new servlet.
 o name
The name of this ServletManager.
 o properties
The properties containing configuration information for these servlets.
 o propertyFile
The file that contains the servlet properties.
 o servletNames
The names of all the named servlet.
 o sessions
The sessions in this manager.
 o startups
The servlet to load on startup.
 o tGroup
The ThreadGroup in which the servlets are run.

Method Index

 o checkReload(JServSendError)
Reinstantiate the classloader if necessary.
 o createSession(HttpServletResponse)
Creates a new session.
 o destroyServlets()
Destroy all the servlets and servlet contexts.
 o encodeUrl(String, String)
Encode a URL with a session identifier.
 o getCookieSessionId(Cookie[])
Get the session identifier set in cookies.
 o getIdentifier()
Get a session identifier.
 o getIds()
Returns an enumeration of all of the session IDs in this context.
 o getLoadedServlets()
Get an enumeration of all the servlets that have been loaded.
 o getName()
Get the name of this ServletManager.
 o getServletNames()
Get all the name that are defined in this ServletManager
 o getSession(String)
Returns the session bound to the specified session ID.
 o getUrlSessionId(String)
Get the session identifier in a query string.
 o init(JServSendError)
Load the configuration from the property file and load the startup servlets.
 o loadServlet(String, JServSendError)
Loads and initialize a servlet.
 o removeSession(JServSession)
Remove a session from the context.

Variables

 o propertyFile
 protected File propertyFile
The file that contains the servlet properties.

 o lastInitialization
 protected long lastInitialization
The time of the last initialization.

 o properties
 protected Properties properties
The properties containing configuration information for these servlets.

 o defaultArgs
 protected Properties defaultArgs
The default init arguments for all the servlet in this name space.

 o loader
 protected JServClassLoader loader
The class loader used for loading new servlet.

 o tGroup
 protected ThreadGroup tGroup
The ThreadGroup in which the servlets are run.

 o name
 protected String name
The name of this ServletManager.

 o startups
 protected String startups
The servlet to load on startup.

 o servletNames
 protected Vector servletNames
The names of all the named servlet.

 o sessions
 protected Hashtable sessions
The sessions in this manager.

Methods

 o init
 public synchronized void init(JServSendError errorHandler)
Load the configuration from the property file and load the startup servlets.

Parameters:
JServSendError - An object that can handle errors.
 o checkReload
 public synchronized void checkReload(JServSendError errorHandler)
Reinstantiate the classloader if necessary. Check if any of the classes has changed or if the property file has been modified. If this is the case, this method does the following :
  1. Destroy all the loaded servlets.
  2. Re-read its configuration file.
  3. Reload the startup servlets.

Parameters:
errorHandler - The object that knows what to do with errors.
 o getServletNames
 public Enumeration getServletNames()
Get all the name that are defined in this ServletManager

 o getLoadedServlets
 public synchronized Enumeration getLoadedServlets()
Get an enumeration of all the servlets that have been loaded.

 o loadServlet
 public synchronized JServContext loadServlet(String name,
                                              JServSendError se) throws ServletException
Loads and initialize a servlet. If the servlet is already loaded and initialized, a reference to the existing context is returned.

Parameters:
servletName - The name of the servlet to load.
errorHandler - The error handler to call back if there is an error.
Returns:
the ServletContext object for the servlet.
Throws: ServletException
If there is an error while initializing the servlet.
 o getName
 public String getName()
Get the name of this ServletManager.

 o destroyServlets
 public synchronized void destroyServlets()
Destroy all the servlets and servlet contexts.

 o getUrlSessionId
 public static final String getUrlSessionId(String queryStr)
Get the session identifier in a query string.

Parameters:
queryStr - The query string that came in from the url.
Returns:
The session identifier encoded in the url, or null if there is no session identifier in the url.
 o getCookieSessionId
 public static final String getCookieSessionId(Cookie cookies[])
Get the session identifier set in cookies.

Parameters:
cookies - The cookies to search for a session identifier.
Returns:
The session identifier found in the cookies, or null if there is none.
 o encodeUrl
 public static String encodeUrl(String url,
                                String id)
Encode a URL with a session identifier.

Parameters:
url - The url to encode.
id - The session identifier to encode with the url.
 o getIdentifier
 public static final String getIdentifier()
Get a session identifier. These should be unique identifier.

 o getSession
 public synchronized HttpSession getSession(String sessionId)
Returns the session bound to the specified session ID.

Parameters:
sessionID - the ID of a particular session object.
Returns:
the session name. Returns null if the session ID does not refer to a valid session.
 o getIds
 public synchronized Enumeration getIds()
Returns an enumeration of all of the session IDs in this context.

Returns:
an enumeration of all session IDs in this context.
 o createSession
 public synchronized JServSession createSession(HttpServletResponse response)
Creates a new session.

Parameters:
response - The response used to send a cookie to the client.
Returns:
A new session.
 o removeSession
 public synchronized void removeSession(JServSession s)
Remove a session from the context. This is called by the session when it is invalidated.

Parameters:
s - The session to remove from this context.

All Packages  Class Hierarchy  This Package  Previous  Next  Index