org.mortbay.jetty.servlet
Class Context
java.lang.Object
org.mortbay.component.AbstractLifeCycle
org.mortbay.jetty.handler.AbstractHandler
org.mortbay.jetty.handler.AbstractHandlerContainer
org.mortbay.jetty.handler.HandlerWrapper
org.mortbay.jetty.handler.ContextHandler
org.mortbay.jetty.servlet.Context
- All Implemented Interfaces:
- LifeCycle, Handler, HandlerContainer, Server.Graceful, Attributes
- Direct Known Subclasses:
- WebAppContext
public class Context
- extends ContextHandler
Servlet Context.
This conveniance extention to the ContextHandler allows for
simple construction of a context with ServletHandler and optionally
session and security handlers, et.
new ServletContext("/context",Context.SESSIONS|Context.NO_SECURITY);
This class should have been called ServletContext, but this would have
cause confusion with ServletContext
.
Constructor Summary |
Context()
|
Context(HandlerContainer parent,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
|
Context(HandlerContainer parent,
String contextPath)
|
Context(HandlerContainer parent,
String contextPath,
boolean sessions,
boolean security)
|
Context(HandlerContainer parent,
String contextPath,
int options)
|
Context(int options)
|
Methods inherited from class org.mortbay.jetty.handler.ContextHandler |
addEventListener, addLocaleEncoding, clearAttributes, doStart, doStop, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getConnectorNames, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getHosts, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getMaxFormContentSize, getMimeTypes, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, isProtectedTarget, isShutdown, loadClass, removeAttribute, setAllowNullPathInfo, setAttribute, setAttributes, setBaseResource, setClassLoader, setConnectorNames, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setHosts, setInitParams, setMaxFormContentSize, setMimeTypes, setResourceBase, setServer, setShutdown, setVirtualHosts, setWelcomeFiles, toString |
SESSIONS
public static final int SESSIONS
- See Also:
- Constant Field Values
SECURITY
public static final int SECURITY
- See Also:
- Constant Field Values
NO_SESSIONS
public static final int NO_SESSIONS
- See Also:
- Constant Field Values
NO_SECURITY
public static final int NO_SECURITY
- See Also:
- Constant Field Values
_securityHandler
protected SecurityHandler _securityHandler
_servletHandler
protected ServletHandler _servletHandler
_sessionHandler
protected SessionHandler _sessionHandler
Context
public Context()
Context
public Context(int options)
Context
public Context(HandlerContainer parent,
String contextPath)
Context
public Context(HandlerContainer parent,
String contextPath,
int options)
Context
public Context(HandlerContainer parent,
String contextPath,
boolean sessions,
boolean security)
Context
public Context(HandlerContainer parent,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
startContext
protected void startContext()
throws Exception
- Overrides:
startContext
in class ContextHandler
- Throws:
Exception
- See Also:
ContextHandler.startContext()
getSecurityHandler
public SecurityHandler getSecurityHandler()
- Returns:
- Returns the securityHandler.
getServletHandler
public ServletHandler getServletHandler()
- Returns:
- Returns the servletHandler.
getSessionHandler
public SessionHandler getSessionHandler()
- Returns:
- Returns the sessionHandler.
addServlet
public ServletHolder addServlet(String className,
String pathSpec)
- conveniance method to add a servlet.
addServlet
public ServletHolder addServlet(Class servlet,
String pathSpec)
- conveniance method to add a servlet.
addServlet
public void addServlet(ServletHolder servlet,
String pathSpec)
- conveniance method to add a servlet.
addFilter
public void addFilter(FilterHolder holder,
String pathSpec,
int dispatches)
- conveniance method to add a filter
addFilter
public FilterHolder addFilter(Class filterClass,
String pathSpec,
int dispatches)
- conveniance method to add a filter
addFilter
public FilterHolder addFilter(String filterClass,
String pathSpec,
int dispatches)
- conveniance method to add a filter
setSessionHandler
public void setSessionHandler(SessionHandler sessionHandler)
- Parameters:
sessionHandler
- The sessionHandler to set.
setSecurityHandler
public void setSecurityHandler(SecurityHandler securityHandler)
- Parameters:
securityHandler
- The SecurityHandler
to set on this context.
setServletHandler
public void setServletHandler(ServletHandler servletHandler)
- Parameters:
servletHandler
- The servletHandler to set.