@ManagedObject(value="Servlet Context Handler") public class ServletContextHandler extends ContextHandler
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.
| Modifier and Type | Class and Description |
|---|---|
class |
ServletContextHandler.Context |
static interface |
ServletContextHandler.Decorator
Deprecated.
use new
Decorator |
static class |
ServletContextHandler.JspConfig |
static class |
ServletContextHandler.JspPropertyGroup |
static interface |
ServletContextHandler.ServletContainerInitializerCaller |
static class |
ServletContextHandler.TagLib |
ContextHandler.AliasCheck, ContextHandler.ApproveAliases, ContextHandler.ApproveNonExistentDirectoryAliases, ContextHandler.Availability, ContextHandler.ContextScopeListener, ContextHandler.StaticContextAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Modifier and Type | Field and Description |
|---|---|
protected Class<? extends SecurityHandler> |
_defaultSecurityHandlerClass |
protected GzipHandler |
_gzipHandler |
protected JspConfigDescriptor |
_jspConfig |
protected DecoratedObjectFactory |
_objFactory |
protected int |
_options |
protected SecurityHandler |
_securityHandler |
protected ServletHandler |
_servletHandler |
protected SessionHandler |
_sessionHandler |
static int |
GZIP |
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)
Deprecated.
use the
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead |
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)
Convenience 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)
Convenience method to add a servlet.
|
void |
addServlet(ServletHolder servlet,
String pathSpec)
Convenience method to add a servlet.
|
ServletHolder |
addServlet(String className,
String pathSpec)
Convenience method to add a servlet.
|
void |
callContextDestroyed(ServletContextListener l,
ServletContextEvent e) |
void |
callContextInitialized(ServletContextListener l,
ServletContextEvent e) |
protected void |
doStart() |
protected void |
doStop() |
protected ServletRegistration.Dynamic |
dynamicHolderAdded(ServletHolder holder)
notification that a ServletRegistration has been created so we can track the annotations
|
List<ServletContextHandler.Decorator> |
getDecorators()
Deprecated.
use the
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead |
Class<? extends SecurityHandler> |
getDefaultSecurityHandlerClass()
Get the defaultSecurityHandlerClass.
|
GzipHandler |
getGzipHandler() |
DecoratedObjectFactory |
getObjectFactory()
The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)
|
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)
Deprecated.
use the
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead |
void |
setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass)
Set the defaultSecurityHandlerClass.
|
void |
setGzipHandler(GzipHandler gzipHandler) |
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.
|
protected void |
stopContext() |
addAliasCheck, addEventListener, addLocaleEncoding, addProgrammaticListener, addVirtualHosts, checkAlias, checkContext, checkContextPath, checkVirtualHost, clearAliasChecks, clearAttributes, doHandle, doScope, dump, enterScope, exitScope, getAliasChecks, getAllowNullPathInfo, getAttribute, getAttributeNames, getAttributes, getBaseResource, getClassLoader, getClassPath, getContextHandler, getContextPath, getContextPathEncoded, getCurrentContext, getDisplayName, getErrorHandler, getEventListeners, getInitParameter, getInitParameterNames, getInitParams, getLocaleEncoding, getLocaleEncoding, getLocaleEncodings, getLogger, getMaxFormContentSize, getMaxFormKeys, getMimeTypes, getProtectedTargets, getResource, getResourceBase, getResourcePaths, getServerInfo, getServletContext, getVirtualHosts, getWelcomeFiles, handle, handle, isAvailable, isCompactPath, isProgrammaticListener, isProtectedTarget, isShutdown, isUsingSecurityManager, 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, setServerInfo, setUsingSecurityManager, setVirtualHosts, setWelcomeFiles, shutdown, toStringhandle, never, nextHandle, nextScopedestroy, expandChildren, getHandler, getHandlersexpandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassdoError, dumpThis, getServeraddBean, 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, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic static final int SESSIONS
public static final int SECURITY
public static final int GZIP
public static final int NO_SESSIONS
public static final int NO_SECURITY
protected final DecoratedObjectFactory _objFactory
protected Class<? extends SecurityHandler> _defaultSecurityHandlerClass
protected SessionHandler _sessionHandler
protected SecurityHandler _securityHandler
protected ServletHandler _servletHandler
protected GzipHandler _gzipHandler
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)
public void setHandler(Handler handler)
setHandler in class HandlerWrapperprotected void doStart()
throws Exception
doStart in class ContextHandlerExceptionprotected void doStop()
throws Exception
doStop in class ContextHandlerExceptionContextHandler.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 ContextHandlerExceptionContextHandler.startContext()protected void stopContext()
throws Exception
stopContext in class ContextHandlerException@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()
@ManagedAttribute(value="context gzip handler", readonly=true) public GzipHandler getGzipHandler()
public ServletHolder addServlet(String className, String pathSpec)
className - the servlet class namepathSpec - the path spec to map servlet topublic ServletHolder addServlet(Class<? extends Servlet> servlet, String pathSpec)
servlet - the servlet classpathSpec - the path spec to map servlet topublic void addServlet(ServletHolder servlet, String pathSpec)
servlet - the servlet holderpathSpec - the path specpublic void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches)
holder - the filter holderpathSpec - the path specdispatches - the dispatcher types for this filterpublic FilterHolder addFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
filterClass - the filter classpathSpec - the path specdispatches - the dispatcher types for this filterpublic FilterHolder addFilter(String filterClass, String pathSpec, EnumSet<DispatcherType> dispatches)
filterClass - the filter class namepathSpec - the path specdispatches - the dispatcher types for this filterprotected 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 ContextHandlerpublic void callContextDestroyed(ServletContextListener l, ServletContextEvent e)
callContextDestroyed in class ContextHandlerpublic void setSessionHandler(SessionHandler sessionHandler)
sessionHandler - The sessionHandler to set.public void setSecurityHandler(SecurityHandler securityHandler)
securityHandler - The SecurityHandler to set on this context.public void setGzipHandler(GzipHandler gzipHandler)
gzipHandler - The GzipHandler to set on this context.public void setServletHandler(ServletHandler servletHandler)
servletHandler - The servletHandler to set.public void insertHandler(HandlerWrapper handler)
insertHandler in class HandlerWrapperpublic DecoratedObjectFactory getObjectFactory()
@Deprecated public List<ServletContextHandler.Decorator> getDecorators()
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() instead@Deprecated public void setDecorators(List<ServletContextHandler.Decorator> decorators)
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() insteaddecorators - The list of ServletContextHandler.Decorators@Deprecated public void addDecorator(ServletContextHandler.Decorator decorator)
DecoratedObjectFactory from getAttribute("org.eclipse.jetty.util.DecoratedObjectFactory") or getObjectFactory() insteaddecorator - The decorator to addCopyright © 1995–2016 Webtide. All rights reserved.