@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.StaticContext
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.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()
Starts the managed lifecycle beans in the order they were added.
|
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()
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, 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, 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, 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 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 HandlerWrapper
handler
- Set the Handler
which should be wrapped.protected void doStart() throws Exception
ContainerLifeCycle
doStart
in class ContextHandler
Exception
AbstractHandler.doStart()
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
- if unable to start the contextContextHandler.startContext()
protected void stopContext() throws Exception
stopContext
in class ContextHandler
Exception
@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 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 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 HandlerWrapper
handler
- the wrapper to insertpublic 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.Decorator
s@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.