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
:
- jserv.timeout - the number of millisecond to wait on
finishing connections before giving up on destroying a servlet. Default to
7000 (7 seconds)
- jserv.autoreload.classes -
Whether to reload servlets whenever one of the loaded class is modified.
Default to true.
- jserv.autoreload.file - Whether to reload servlets when
the servlet configuration file changes.
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
-
defaultArgs
- The default init arguments for all the servlet
in this name space.
-
lastInitialization
- The time of the last initialization.
-
loader
- The class loader used for loading new servlet.
-
name
- The name of this ServletManager.
-
properties
- The properties containing configuration information
for these servlets.
-
propertyFile
- The file that contains the servlet properties.
-
servletNames
- The names of all the named servlet.
-
sessions
- The sessions in this manager.
-
startups
- The servlet to load on startup.
-
tGroup
- The ThreadGroup in which the servlets are run.
-
checkReload(JServSendError)
-
Reinstantiate the classloader if necessary.
-
createSession(HttpServletResponse)
- Creates a new session.
-
destroyServlets()
- Destroy all the servlets and servlet contexts.
-
encodeUrl(String, String)
- Encode a URL with a session identifier.
-
getCookieSessionId(Cookie[])
- Get the session identifier set in cookies.
-
getIdentifier()
- Get a session identifier.
-
getIds()
- Returns an enumeration of all of the session IDs in this context.
-
getLoadedServlets()
- Get an enumeration of all the servlets that have been loaded.
-
getName()
- Get the name of this ServletManager.
-
getServletNames()
- Get all the name that are defined in this ServletManager
-
getSession(String)
- Returns the session bound to the specified session ID.
-
getUrlSessionId(String)
- Get the session identifier in a query string.
-
init(JServSendError)
- Load the configuration from the property file and load the
startup servlets.
-
loadServlet(String, JServSendError)
- Loads and initialize a servlet.
-
removeSession(JServSession)
- Remove a session from the context.
propertyFile
protected File propertyFile
- The file that contains the servlet properties.
lastInitialization
protected long lastInitialization
- The time of the last initialization.
properties
protected Properties properties
- The properties containing configuration information
for these servlets.
defaultArgs
protected Properties defaultArgs
- The default init arguments for all the servlet
in this name space.
loader
protected JServClassLoader loader
- The class loader used for loading new servlet.
tGroup
protected ThreadGroup tGroup
- The ThreadGroup in which the servlets are run.
name
protected String name
- The name of this ServletManager.
startups
protected String startups
- The servlet to load on startup.
servletNames
protected Vector servletNames
- The names of all the named servlet.
sessions
protected Hashtable sessions
- The sessions in this manager.
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.
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 :
- Destroy all the loaded servlets.
- Re-read its configuration file.
- Reload the startup servlets.
- Parameters:
- errorHandler - The object that knows what to do with errors.
getServletNames
public Enumeration getServletNames()
- Get all the name that are defined in this ServletManager
getLoadedServlets
public synchronized Enumeration getLoadedServlets()
- Get an enumeration of all the servlets that have been loaded.
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.
getName
public String getName()
- Get the name of this ServletManager.
destroyServlets
public synchronized void destroyServlets()
- Destroy all the servlets and servlet contexts.
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.
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.
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.
getIdentifier
public static final String getIdentifier()
- Get a session identifier. These should be unique identifier.
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.
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.
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.
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