org.mortbay.jetty.servlet
public class ServletHandler extends Container implements HttpHandler
This handler does not implement the full J2EE features and is intended to be used when a full web application is not required. Specifically filters and request wrapping are not supported.
If a SessionManager is not added to the handler before it is initialized, then a HashSessionManager with a standard java.util.Random generator is created.
Version: $Id: ServletHandler.java,v 1.133 2006/03/15 14:43:00 gregwilkins Exp $
See Also: WebApplicationHandler
| Field Summary | |
|---|---|
| protected Map | _attributes |
| protected ServletHandler.Context | _context |
| protected Log | _contextLog |
| protected String | _formErrorPage |
| protected String | _formLoginPage |
| protected HttpContext | _httpContext |
| protected ClassLoader | _loader |
| protected Map | _nameMap |
| protected PathMap | _servletMap |
| protected SessionManager | _sessionManager |
| static String | __DEFAULT_SERVLET |
| static String | __J_S_CONTEXT_TEMPDIR |
| static String | __J_S_ERROR_EXCEPTION |
| static String | __J_S_ERROR_EXCEPTION_TYPE |
| static String | __J_S_ERROR_MESSAGE |
| static String | __J_S_ERROR_REQUEST_URI |
| static String | __J_S_ERROR_SERVLET_NAME |
| static String | __J_S_ERROR_STATUS_CODE |
| Constructor Summary | |
|---|---|
| ServletHandler() Constructor. | |
| Method Summary | |
|---|---|
| ServletHolder | addServlet(String name, String pathSpec, String servletClass, String forcedPath) Add a servlet. |
| ServletHolder | addServlet(String name, String pathSpec, String servletClass) Add a servlet. |
| ServletHolder | addServlet(String pathSpec, String servletClass)
Add a servlet instance to this handler and map it to a pathspec. |
| void | addServletHolder(ServletHolder holder)
Register an existing ServletHolder with this handler. |
| void | destroy() |
| protected void | dispatch(String pathInContext, HttpServletRequest request, HttpServletResponse response, ServletHolder servletHolder, int type) Dispatch to a servletHolder.
|
| protected void | doStart() |
| protected void | doStop() |
| protected void | finalize() |
| void | formAuthInit(String formLoginPage, String formErrorPage) |
| ClassLoader | getClassLoader() |
| protected Object | getContextAttribute(String name) Get context attribute.
|
| protected Enumeration | getContextAttributeNames() Get context attribute names.
|
| String | getErrorPage(int status, ServletHttpRequest request) |
| Entry | getHolderEntry(String pathInContext) ServletHolder matching path. |
| HttpContext | getHttpContext() |
| HttpSession | getHttpSession(String id) |
| String | getName() |
| RequestDispatcher | getNamedDispatcher(String name) Get Named dispatcher. |
| String | getRealPath(String path) |
| RequestDispatcher | getRequestDispatcher(String uriInContext) |
| URL | getResource(String uriInContext) Get a Resource.
|
| InputStream | getResourceAsStream(String uriInContext) |
| Set | getResourcePaths(String uriInContext) |
| ServletContext | getServletContext() |
| ServletHolder | getServletHolder(String name) |
| PathMap | getServletMap() |
| ServletHolder[] | getServlets() Get Servlets. |
| SessionManager | getSessionManager() |
| void | handle(String pathInContext, String pathParams, HttpRequest httpRequest, HttpResponse httpResponse) Handle request. |
| protected void | handleOptions(HttpServletRequest request, HttpServletResponse response) |
| protected void | handleTrace(HttpServletRequest request, HttpServletResponse response) |
| void | handleTrace(HttpRequest request, HttpResponse response) |
| void | initialize(HttpContext context) |
| void | initializeServlets() Initialize load-on-startup servlets.
|
| boolean | isAutoInitializeServlets() |
| boolean | isUsingCookies() |
| ServletHolder | mapPathToServlet(String pathSpec, String servletName)
Map a servlet to a pathSpec |
| HttpSession | newHttpSession(HttpServletRequest request) |
| ServletHolder | newServletHolder(String name, String servletClass, String forcedPath) |
| ServletHolder | newServletHolder(String name, String servletClass) |
| protected void | notFound(HttpServletRequest request, HttpServletResponse response) |
| protected void | removeContextAttribute(String name) |
| void | setAutoInitializeServlets(boolean b) |
| protected void | setContextAttribute(String name, Object value) |
| void | setDynamicInitParams(Map initParams) Set dynamic servlet initial parameters. |
| void | setDynamicServletPathSpec(String dynamicServletPathSpec) Set the dynamic servlet path. |
| void | setName(String name) |
| void | setServeDynamicSystemServlets(boolean b) Set serving dynamic system servlets. |
| void | setSessionInactiveInterval(int seconds)
Set the session timeout interval in seconds. |
| void | setSessionManager(SessionManager sm) |
| void | setUsingCookies(boolean uc) |
Parameters: name The servlet name. pathSpec A path specification to map this servlet to. servletClass The class name of the servlet. forcedPath If non null, the request attribute javax.servlet.include.servlet_path will be set to this path before service is called.
Returns: The ServletHolder for the servlet.
Parameters: name The servlet name. pathSpec A path specification to map this servlet to. servletClass The class name of the servlet.
Returns: The ServletHolder for the servlet.
Parameters: pathSpec The pathmapping servletClass The class of the servlet
Returns: The created ServletHolder
Parameters: holder the ServletHolder to register.
Parameters: pathInContext The path used to select the servlet holder. request response servletHolder type the type of dispatch as defined in the Dispatcher class.
Throws: ServletException UnavailableException IOException
Parameters: name attribute name.
Returns: attribute
Parameters: pathInContext Path within context.
Returns: PathMap Entries pathspec to ServletHolder
Parameters: name The name of the servlet. If null or empty string, the containers default servlet is returned.
Returns: Request dispatcher for the named servlet.
Parameters: uriInContext
Returns: URL of the resource.
Throws: MalformedURLException
Returns: Array of defined servlets
Parameters: pathInContext pathParams httpRequest httpResponse
Throws: IOException
Parameters: pathSpec The pathspec to map servletName The name of the servlet, which must have already been added.
Returns: The servlet holder of the mapped servlet.
Deprecated: Use org.mortbay.jetty.servlet.Invoker
Set dynamic servlet initial parameters.Deprecated: Use org.mortbay.jetty.servlet.Invoker
Set the dynamic servlet path.Deprecated: Use org.mortbay.jetty.servlet.Invoker
Set serving dynamic system servlets.Parameters: seconds the length of the session timeout interval in seconds.
Parameters: uc If true, cookies are used for sessions