org.eclipse.jetty.servlet
Class ServletContextHandler
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.server.handler.AbstractHandler
org.eclipse.jetty.server.handler.AbstractHandlerContainer
org.eclipse.jetty.server.handler.HandlerWrapper
org.eclipse.jetty.server.handler.ContextHandler
org.eclipse.jetty.servlet.ServletContextHandler
- All Implemented Interfaces:
- Handler, CompleteHandler, HandlerContainer, Server.Graceful, Attributes, LifeCycle
public class ServletContextHandler
- extends ContextHandler
Servlet Context.
This extension 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 |
ServletContextHandler()
|
ServletContextHandler(HandlerContainer parent,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
|
ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath)
|
ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
boolean sessions,
boolean security)
|
ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
int options)
|
ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
|
ServletContextHandler(int options)
|
Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler |
addEventListener, addLocaleEncoding, clearAttributes, complete, doHandle, doStart, doStop, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getConnectorNames, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getHosts, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLogger, getMaxFormContentSize, getMimeTypes, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, handle, isAliases, isCompactPath, isProtectedTarget, isShutdown, loadClass, newResource, newResource, removeAttribute, setAliases, setAllowNullPathInfo, setAttribute, setAttributes, setBaseResource, setClassLoader, setCompactPath, setConnectorNames, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setHosts, setInitParams, setLogger, setMaxFormContentSize, setMimeTypes, setResourceBase, setServer, setShutdown, setVirtualHosts, setWelcomeFiles, toString |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
_defaultSecurityHandlerClass
protected java.lang.Class<? extends SecurityHandler> _defaultSecurityHandlerClass
_sessionHandler
protected SessionHandler _sessionHandler
_securityHandler
protected SecurityHandler _securityHandler
_servletHandler
protected ServletHandler _servletHandler
_options
protected int _options
ServletContextHandler
public ServletContextHandler()
ServletContextHandler
public ServletContextHandler(int options)
ServletContextHandler
public ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath)
ServletContextHandler
public ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
int options)
ServletContextHandler
public ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
boolean sessions,
boolean security)
ServletContextHandler
public ServletContextHandler(HandlerContainer parent,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
ServletContextHandler
public ServletContextHandler(HandlerContainer parent,
java.lang.String contextPath,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler)
getDefaultSecurityHandlerClass
public java.lang.Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()
- Get the defaultSecurityHandlerClass.
- Returns:
- the defaultSecurityHandlerClass
setDefaultSecurityHandlerClass
public void setDefaultSecurityHandlerClass(java.lang.Class<? extends SecurityHandler> defaultSecurityHandlerClass)
- Set the defaultSecurityHandlerClass.
- Parameters:
defaultSecurityHandlerClass
- the defaultSecurityHandlerClass to set
newSessionHandler
protected SessionHandler newSessionHandler()
newSecurityHandler
protected SecurityHandler newSecurityHandler()
newServletHandler
protected ServletHandler newServletHandler()
startContext
protected void startContext()
throws java.lang.Exception
- Finish constructing handlers and link them together.
- Overrides:
startContext
in class ContextHandler
- Throws:
java.lang.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(java.lang.String className,
java.lang.String pathSpec)
- conveniance method to add a servlet.
addServlet
public ServletHolder addServlet(java.lang.Class<? extends javax.servlet.Servlet> servlet,
java.lang.String pathSpec)
- conveniance method to add a servlet.
addServlet
public void addServlet(ServletHolder servlet,
java.lang.String pathSpec)
- conveniance method to add a servlet.
addFilter
public void addFilter(FilterHolder holder,
java.lang.String pathSpec,
int dispatches)
- conveniance method to add a filter
addFilter
public FilterHolder addFilter(java.lang.Class<? extends javax.servlet.Filter> filterClass,
java.lang.String pathSpec,
int dispatches)
- convenience method to add a filter
addFilter
public FilterHolder addFilter(java.lang.String filterClass,
java.lang.String pathSpec,
int dispatches)
- convenience 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.
Copyright © 1995-2009 Mort Bay Consulting. All Rights Reserved.