@ManagedObject(value="Servlet Context Handler") public class ServletContextHandler extends ContextHandler
new ServletContext("/context",Context.SESSIONS|Context.NO_SECURITY);This class should have been called ServletContext, but this would have cause confusion with
ServletContext
.Modifier and Type | Class and Description |
---|---|
class |
ServletContextHandler.Context |
static interface |
ServletContextHandler.Decorator
Interface to decorate loaded classes.
|
static class |
ServletContextHandler.JspConfig |
static class |
ServletContextHandler.JspPropertyGroup |
static interface |
ServletContextHandler.ServletContainerInitializerCaller |
static class |
ServletContextHandler.TagLib |
ContextHandler.AliasCheck, ContextHandler.ApproveAliases, ContextHandler.ApproveNonExistentDirectoryAliases, ContextHandler.ApprovePathPrefixAliases, ContextHandler.ApproveSameSuffixAliases, ContextHandler.Availability, ContextHandler.NoContext
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
Modifier and Type | Field and Description |
---|---|
protected List<ServletContextHandler.Decorator> |
_decorators |
protected Class<? extends SecurityHandler> |
_defaultSecurityHandlerClass |
protected JspConfigDescriptor |
_jspConfig |
protected int |
_options |
protected SecurityHandler |
_securityHandler |
protected ServletHandler |
_servletHandler |
protected SessionHandler |
_sessionHandler |
static int |
NO_SECURITY |
static int |
NO_SESSIONS |
static int |
SECURITY |
static int |
SESSIONS |
_scontext, DEFAULT_LISTENER_TYPE_INDEX, EXTENDED_LISTENER_TYPE_INDEX, MANAGED_ATTRIBUTES, SERVLET_LISTENER_TYPES, SERVLET_MAJOR_VERSION, SERVLET_MINOR_VERSION
_nextScope, _outerScope
_handler
Constructor and Description |
---|
ServletContextHandler() |
ServletContextHandler(HandlerContainer parent,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler) |
ServletContextHandler(HandlerContainer parent,
String contextPath) |
ServletContextHandler(HandlerContainer parent,
String contextPath,
boolean sessions,
boolean security) |
ServletContextHandler(HandlerContainer parent,
String contextPath,
int options) |
ServletContextHandler(HandlerContainer parent,
String contextPath,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler) |
ServletContextHandler(HandlerContainer parent,
String contextPath,
SessionHandler sessionHandler,
SecurityHandler securityHandler,
ServletHandler servletHandler,
ErrorHandler errorHandler,
int options) |
ServletContextHandler(int options) |
Modifier and Type | Method and Description |
---|---|
void |
addDecorator(ServletContextHandler.Decorator decorator) |
FilterHolder |
addFilter(Class<? extends Filter> filterClass,
String pathSpec,
EnumSet<DispatcherType> dispatches)
convenience method to add a filter
|
void |
addFilter(FilterHolder holder,
String pathSpec,
EnumSet<DispatcherType> dispatches)
conveniance method to add a filter
|
FilterHolder |
addFilter(String filterClass,
String pathSpec,
EnumSet<DispatcherType> dispatches)
convenience method to add a filter
|
protected void |
addRoles(String... roleNames)
delegate for ServletContext.declareRole method
|
ServletHolder |
addServlet(Class<? extends Servlet> servlet,
String pathSpec)
conveniance method to add a servlet.
|
void |
addServlet(ServletHolder servlet,
String pathSpec)
conveniance method to add a servlet.
|
ServletHolder |
addServlet(String className,
String pathSpec)
conveniance method to add a servlet.
|
void |
callContextDestroyed(ServletContextListener l,
ServletContextEvent e) |
void |
callContextInitialized(ServletContextListener l,
ServletContextEvent e) |
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
protected ServletRegistration.Dynamic |
dynamicHolderAdded(ServletHolder holder)
notification that a ServletRegistration has been created so we can track the annotations
|
List<ServletContextHandler.Decorator> |
getDecorators() |
Class<? extends SecurityHandler> |
getDefaultSecurityHandlerClass()
Get the defaultSecurityHandlerClass.
|
SecurityHandler |
getSecurityHandler() |
ServletHandler |
getServletHandler() |
SessionHandler |
getSessionHandler() |
void |
insertHandler(HandlerWrapper handler)
Insert a HandlerWrapper before the first Session,Security or ServletHandler
but after any other HandlerWrappers.
|
protected SecurityHandler |
newSecurityHandler() |
protected ServletHandler |
newServletHandler() |
protected SessionHandler |
newSessionHandler() |
void |
setDecorators(List<ServletContextHandler.Decorator> decorators) |
void |
setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
Set the defaultSecurityHandlerClass.
|
void |
setHandler(Handler handler) |
void |
setSecurityHandler(SecurityHandler securityHandler) |
void |
setServletHandler(ServletHandler servletHandler) |
Set<String> |
setServletSecurity(ServletRegistration.Dynamic registration,
ServletSecurityElement servletSecurityElement)
Delegate for ServletRegistration.Dynamic.setServletSecurity method
|
void |
setSessionHandler(SessionHandler sessionHandler) |
protected void |
startContext()
Finish constructing handlers and link them together.
|
addAliasCheck, addEventListener, addLocaleEncoding, addProgrammaticListener, addVirtualHosts, checkAlias, checkContext, checkContextPath, checkManagedAttribute, checkVirtualHost, clearAttributes, doHandle, doScope, doStart, dump, getAliasChecks, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getContextHandler, getContextPath, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLocaleEncodings, getLogger, getMaxFormContentSize, getMaxFormKeys, getMimeTypes, getProtectedTargets, getResource, getResourceBase, getResourcePaths, getServletContext, getVirtualHosts, getWelcomeFiles, handle, isAvailable, isCompactPath, isProgrammaticListener, isProtectedTarget, isShutdown, loadClass, newResource, newResource, newResource, removeAttribute, removeEventListener, removeVirtualHosts, setAliasChecks, setAllowNullPathInfo, setAttribute, setAttributes, setAvailable, setBaseResource, setClassLoader, setCompactPath, setContextPath, setDisplayName, setErrorHandler, setEventListeners, setInitParameter, setLogger, setManagedAttribute, setMaxFormContentSize, setMaxFormKeys, setMimeTypes, setProtectedTargets, setResourceBase, setServer, setVirtualHosts, setWelcomeFiles, shutdown, toString
handle, never, nextHandle, nextScope
destroy, expandChildren, getHandler, getHandlers
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
dumpThis, getServer
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public static final int SESSIONS
public static final int SECURITY
public static final int NO_SESSIONS
public static final int NO_SECURITY
protected final List<ServletContextHandler.Decorator> _decorators
protected Class<? extends SecurityHandler> _defaultSecurityHandlerClass
protected SessionHandler _sessionHandler
protected SecurityHandler _securityHandler
protected ServletHandler _servletHandler
protected int _options
protected JspConfigDescriptor _jspConfig
public ServletContextHandler()
public ServletContextHandler(int options)
public ServletContextHandler(HandlerContainer parent, String contextPath)
public ServletContextHandler(HandlerContainer parent, String contextPath, int options)
public ServletContextHandler(HandlerContainer parent, String contextPath, boolean sessions, boolean security)
public ServletContextHandler(HandlerContainer parent, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
public ServletContextHandler(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler)
public ServletContextHandler(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options)
protected void doStop() throws Exception
ContainerLifeCycle
doStop
in class ContextHandler
Exception
ContextHandler.doStop()
public Class<? extends SecurityHandler> getDefaultSecurityHandlerClass()
public void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
defaultSecurityHandlerClass
- the defaultSecurityHandlerClass to setprotected SessionHandler newSessionHandler()
protected SecurityHandler newSecurityHandler()
protected ServletHandler newServletHandler()
protected void startContext() throws Exception
startContext
in class ContextHandler
Exception
ContextHandler.startContext()
@ManagedAttribute(value="context security handler", readonly=true) public SecurityHandler getSecurityHandler()
@ManagedAttribute(value="context servlet handler", readonly=true) public ServletHandler getServletHandler()
@ManagedAttribute(value="context session handler", readonly=true) public SessionHandler getSessionHandler()
public ServletHolder addServlet(String className, String pathSpec)
public ServletHolder addServlet(Class<? extends Servlet> servlet, String pathSpec)
public void addServlet(ServletHolder servlet, String pathSpec)
public void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches)
public FilterHolder addFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
public FilterHolder addFilter(String filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
protected ServletRegistration.Dynamic dynamicHolderAdded(ServletHolder holder)
holder
- new holder created through the api.protected void addRoles(String... roleNames)
roleNames
- role names to addpublic Set<String> setServletSecurity(ServletRegistration.Dynamic registration, ServletSecurityElement servletSecurityElement)
registration
- ServletRegistration.Dynamic instance that setServletSecurity was called onservletSecurityElement
- new security infopublic void callContextInitialized(ServletContextListener l, ServletContextEvent e)
callContextInitialized
in class ContextHandler
public void callContextDestroyed(ServletContextListener l, ServletContextEvent e)
callContextDestroyed
in class ContextHandler
public void setSessionHandler(SessionHandler sessionHandler)
sessionHandler
- The sessionHandler to set.public void setSecurityHandler(SecurityHandler securityHandler)
securityHandler
- The SecurityHandler
to set on this context.public void setServletHandler(ServletHandler servletHandler)
servletHandler
- The servletHandler to set.public void setHandler(Handler handler)
setHandler
in class HandlerWrapper
handler
- Set the Handler
which should be wrapped.public void insertHandler(HandlerWrapper handler)
public List<ServletContextHandler.Decorator> getDecorators()
public void setDecorators(List<ServletContextHandler.Decorator> decorators)
decorators
- The lis of ServletContextHandler.Decorator
spublic void addDecorator(ServletContextHandler.Decorator decorator)
decorator
- The decorator to addCopyright © 1995-2015 Webtide. All Rights Reserved.