Class ServletContextHandler
- All Implemented Interfaces:
AliasCheck
,Handler
,Handler.Container
,Handler.Singleton
,Request.Handler
,Attributes
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
,Invocable
- Direct Known Subclasses:
WebAppContext
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
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
static class
static interface
static class
Bean that is added to the ServletContextHandler to start all of the ServletContainerInitializers by starting their corresponding ServletContainerInitializerHolders when this bean is itself started.class
static interface
Listener for all threads entering context scope, including async IO callbacksstatic interface
The interface used byServletApiRequest
to access theServletContextRequest
without access to the unwrappedRequest
methods.static interface
The interface used byServletApiResponse
to access theServletContextResponse
without access to the unwrappedResponse
methods.class
static class
Nested classes/interfaces inherited from class org.eclipse.jetty.server.handler.ContextHandler
ContextHandler.Availability, ContextHandler.ContextScopeListener, ContextHandler.ScopedContext
Nested classes/interfaces inherited from class org.eclipse.jetty.server.Handler.Abstract
Handler.Abstract.NonBlocking
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.server.Request.Handler
Request.Handler.AbortException
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Environment
Deprecated, for removal: This API element is subject to removal in a future version.protected ServletContextHandler.ContextStatus
protected jakarta.servlet.descriptor.JspConfigDescriptor
protected final DecoratedObjectFactory
protected int
protected SecurityHandler
protected ServletHandler
protected SessionHandler
static final int
static final int
static final int
static final Environment
static final int
static final String
static final String
static final int
static final int
static final int
static final Class<?>[]
static final int
Fields inherited from class org.eclipse.jetty.server.handler.ContextHandler
CROSS_CONTEXT_ATTRIBUTE, MANAGED_ATTRIBUTES
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
FAILED, STARTED, STARTING, STOPPED, STOPPING
Fields inherited from interface org.eclipse.jetty.util.Attributes
NULL
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking, NOOP
-
Constructor Summary
ConstructorDescriptionServletContextHandler
(int options) ServletContextHandler
(String contextPath) ServletContextHandler
(String contextPath, boolean sessions, boolean security) ServletContextHandler
(String contextPath, int options) ServletContextHandler
(String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) ServletContextHandler
(String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options) ServletContextHandler
(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addEventListener
(EventListener listener) Add a context event listeners.addFilter
(jakarta.servlet.Filter filter, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a servlet.addFilter
(Class<? extends jakarta.servlet.Filter> filterClass, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filterConvenience method to add a filtervoid
addFilter
(FilterHolder holder, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filtervoid
addLocaleEncoding
(String locale, String encoding) protected void
addProgrammaticListener
(EventListener listener) Apply any necessary restrictions on a programmatic added listener.protected void
delegate for ServletContext.declareRole methodaddServlet
(jakarta.servlet.http.HttpServlet servlet, String pathSpec) Convenience method to add a servlet.addServlet
(Class<? extends jakarta.servlet.Servlet> servlet, String pathSpec) Convenience method to add a servlet.addServlet
(String className, String pathSpec) Convenience method to add a servlet.void
addServlet
(ServletHolder servlet, String pathSpec) Convenience method to add a servlet.addServletContainerInitializer
(jakarta.servlet.ServletContainerInitializer sci) Convenience method to programmatically add aServletContainerInitializer
.addServletContainerInitializer
(jakarta.servlet.ServletContainerInitializer sci, Class<?>... classes) Convenience method to programmatically add aServletContainerInitializer
.void
addServletContainerInitializer
(ServletContainerInitializerHolder... sciHolders) Convenience method to programmatically add a list ofServletContainerInitializer
.void
callContextDestroyed
(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) void
callContextInitialized
(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) void
Call the ServletContextListeners with contextDestroyed.void
Call the ServletContextListeners contextInitialized methods.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.void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected jakarta.servlet.ServletRegistration.Dynamic
dynamicHolderAdded
(ServletHolder holder) notification that a ServletRegistration has been created so we can track the annotationsstatic jakarta.servlet.ServletContext
static ServletContextHandler
Class<? extends SecurityHandler>
Get the defaultSecurityHandlerClass.getInitParameter
(String name) getLocaleEncoding
(String locale) getLocaleEncoding
(Locale locale) Get the character encoding for a locale.Get all of the locale encodingsorg.slf4j.Logger
int
int
The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)Get the context path in a form suitable to be returned fromHttpServletRequest.getContextPath()
orServletContext.getContextPath()
.getResource
(String pathInContext) Attempt to get a Resource from the Context.getResourcePaths
(String path) jakarta.servlet.ServletContext
static jakarta.servlet.ServletContext
getServletContext
(Context context) static ServletContextHandler
getServletContextHandler
(jakarta.servlet.ServletContext servletContext) static ServletContextHandler
getServletContextHandler
(jakarta.servlet.ServletContext servletContext, String purpose) String[]
protected boolean
handleByContextHandler
(String pathInContext, ContextRequest request, Response response, Callback callback) void
insertHandler
(Handler.Singleton handler) Insert a HandlerWrapper before the first Session, Security or ServletHandler but after any other HandlerWrappers.boolean
isDurableListener
(EventListener listener) boolean
isProgrammaticListener
(EventListener listener) boolean
Class<?>
protected ContextHandler.ScopedContext
newResource
(String urlOrPath) Convert a URL or path to a Resource.newResource
(URI uri) Convert URL to Resource wrapper forResourceFactory.newResource(URL)
enables extensions to provide alternate resource implementations.newResource
(URL url) Convert URL to Resource wrapper forResourceFactory.newResource(URL)
enables extensions to provide alternate resource implementations.protected SecurityHandler
protected ServletContextRequest
newServletContextRequest
(ServletChannel servletChannel, Request request, Response response, String decodedPathInContext, MatchedResource<ServletHandler.MappedServlet> matchedResource) protected ServletHandler
protected SessionHandler
protected void
notifyEnterScope
(Request request) protected void
notifyExitScope
(Request request) boolean
removeEventListener
(EventListener listener) Remove an event listener.protected void
requestDestroyed
(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) protected void
requestInitialized
(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) void
setContextPath
(String contextPath) void
setDefaultRequestCharacterEncoding
(String encoding) void
setDefaultResponseCharacterEncoding
(String encoding) void
setDefaultSecurityHandlerClass
(Class<? extends SecurityHandler> defaultSecurityHandlerClass) Set the defaultSecurityHandlerClass.void
setHandler
(Handler handler) setInitParameter
(String name, String value) void
setLogger
(org.slf4j.Logger logger) void
setMaxFormContentSize
(int maxSize) Set the maximum size of a form post, to protect against DOS attacks from large forms.void
setMaxFormKeys
(int max) Set the maximum number of form Keys to protect against DOS attack from crafted hash keys.void
setSecurityHandler
(SecurityHandler securityHandler) void
setServletHandler
(ServletHandler servletHandler) setServletSecurity
(jakarta.servlet.ServletRegistration.Dynamic registration, jakarta.servlet.ServletSecurityElement servletSecurityElement) Delegate for ServletRegistration.Dynamic.setServletSecurity methodvoid
setSessionHandler
(SessionHandler sessionHandler) void
setTempDirectory
(File tempDirectory) Set the temporary directory returned byContextHandler.ScopedContext.getTempDirectory()
.void
setUsingSecurityManager
(boolean usingSecurityManager) void
setWelcomeFiles
(String[] files) protected void
Finish constructing handlers and link them together.protected void
protected ContextRequest
wrapRequest
(Request request, Response response) protected ContextResponse
wrapResponse
(ContextRequest request, Response response) Methods inherited from class org.eclipse.jetty.server.handler.ContextHandler
addAliasCheck, addVirtualHosts, checkAlias, checkVirtualHost, cleanupAfterStop, clearAliasChecks, clearAttributes, createTempDirectory, destroy, enterScope, exitScope, getAliasChecks, getAllowNullPathInContext, getAttribute, getAttributeNameSet, getBaseName, getBaseResource, getCanonicalNameForTmpDir, getClassLoader, getClassPath, getContextHandler, getContextPath, getCrossContextHandler, getCurrentContext, getCurrentContext, getCurrentContextHandler, getDisplayName, getErrorHandler, getMimeTypes, getProtectedTargets, getResourceForTempDirName, getTempDirectory, getVirtualHosts, handle, handleMovedPermanently, handleUnavailable, isAvailable, isCrossContextDispatchSupported, isProtectedTarget, isTempDirectoryPersistent, makeTempDirectory, removeAttribute, removeVirtualHosts, setAliasChecks, setAllowNullPathInContext, setAttribute, setAvailable, setBaseResource, setBaseResourceAsPath, setBaseResourceAsString, setClassLoader, setCrossContextDispatchSupported, setDisplayName, setErrorHandler, setProtectedTargets, setServer, setTempDirectoryPersistent, setVirtualHosts, toString
Methods inherited from class org.eclipse.jetty.server.Handler.Wrapper
getHandler
Methods inherited from class org.eclipse.jetty.server.Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamic
Methods inherited from class org.eclipse.jetty.server.Handler.Abstract
getServer
Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addManaged, contains, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, installBean, installBean, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, equals, hashCode
Methods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListeners
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
Methods inherited from interface org.eclipse.jetty.server.Handler.Container
getContainer, getDescendant, getDescendants, getDescendants
Methods inherited from interface org.eclipse.jetty.server.Handler.Singleton
getHandlers, getTail, setHandler
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, start, stop
-
Field Details
-
ENVIRONMENT
-
__environment
Deprecated, for removal: This API element is subject to removal in a future version.UseENVIRONMENT
instead. -
SERVLET_LISTENER_TYPES
-
DEFAULT_LISTENER_TYPE_INDEX
public static final int DEFAULT_LISTENER_TYPE_INDEX- See Also:
-
EXTENDED_LISTENER_TYPE_INDEX
public static final int EXTENDED_LISTENER_TYPE_INDEX- See Also:
-
MAX_FORM_KEYS_KEY
- See Also:
-
MAX_FORM_CONTENT_SIZE_KEY
- See Also:
-
DEFAULT_MAX_FORM_KEYS
public static final int DEFAULT_MAX_FORM_KEYS- See Also:
-
DEFAULT_MAX_FORM_CONTENT_SIZE
public static final int DEFAULT_MAX_FORM_CONTENT_SIZE- See Also:
-
SESSIONS
public static final int SESSIONS- See Also:
-
SECURITY
public static final int SECURITY- See Also:
-
NO_SESSIONS
public static final int NO_SESSIONS- See Also:
-
NO_SECURITY
public static final int NO_SECURITY- See Also:
-
_contextStatus
-
_objFactory
-
_sessionHandler
-
_securityHandler
-
_servletHandler
-
_options
protected int _options -
_jspConfig
protected jakarta.servlet.descriptor.JspConfigDescriptor _jspConfig
-
-
Constructor Details
-
ServletContextHandler
public ServletContextHandler() -
ServletContextHandler
-
ServletContextHandler
public ServletContextHandler(int options) -
ServletContextHandler
-
ServletContextHandler
-
ServletContextHandler
public ServletContextHandler(SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) -
ServletContextHandler
public ServletContextHandler(String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler) -
ServletContextHandler
public ServletContextHandler(String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler, int options)
-
-
Method Details
-
getServletContextHandler
public static ServletContextHandler getServletContextHandler(jakarta.servlet.ServletContext servletContext, String purpose) -
getServletContextHandler
public static ServletContextHandler getServletContextHandler(jakarta.servlet.ServletContext servletContext) -
getCurrentServletContext
public static jakarta.servlet.ServletContext getCurrentServletContext() -
getServletContext
-
getCurrentServletContextHandler
-
setTempDirectory
Description copied from class:ContextHandler
Set the temporary directory returned by
ContextHandler.ScopedContext.getTempDirectory()
. If not set here, then theServer.getTempDirectory()
is returned byContextHandler.ScopedContext.getTempDirectory()
.If
ContextHandler.isTempDirectoryPersistent()
is true, the directory set here is used directly but may be created if it does not exist. IfContextHandler.isTempDirectoryPersistent()
is false, then anyFile
set here will be deleted and recreated as a directory duringAbstractLifeCycle.start()
and will be deleted duringAbstractLifeCycle.stop()
.- Overrides:
setTempDirectory
in classContextHandler
- Parameters:
tempDirectory
- A directory. If it does not exist, it must be able to be created during start.- See Also:
-
newServletContextApi
-
getInvocationType
- Specified by:
getInvocationType
in interfaceInvocable
- Specified by:
getInvocationType
in interfaceRequest.Handler
- Overrides:
getInvocationType
in classHandler.Wrapper
- Returns:
- The InvocationType of this object
-
dump
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Overrides:
dump
in classContextHandler
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
isUsingSecurityManager
public boolean isUsingSecurityManager() -
setUsingSecurityManager
public void setUsingSecurityManager(boolean usingSecurityManager) -
getContextPathEncoded
- Returns:
- Returns the encoded contextPath.
-
getRequestContextPath
Get the context path in a form suitable to be returned fromHttpServletRequest.getContextPath()
orServletContext.getContextPath()
.- Returns:
- Returns the encoded contextPath, or empty string for root context
-
getInitParameter
-
setInitParameter
-
getInitParameterNames
-
getInitParams
@ManagedAttribute("Initial Parameter map for the context") public Map<String,String> getInitParams()- Returns:
- Returns the initParams.
-
removeEventListener
Description copied from interface:Container
Remove an event listener.- Specified by:
removeEventListener
in interfaceContainer
- Specified by:
removeEventListener
in interfaceLifeCycle
- Overrides:
removeEventListener
in classContextHandler
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was removed
- See Also:
-
addProgrammaticListener
Apply any necessary restrictions on a programmatic added listener.- Parameters:
listener
- the programmatic listener to add
-
isProgrammaticListener
-
isDurableListener
-
getLogger
public org.slf4j.Logger getLogger() -
setLogger
public void setLogger(org.slf4j.Logger logger) -
contextInitialized
Call the ServletContextListeners contextInitialized methods. This can be called from a ServletHandler during the proper sequence of initializing filters, servlets and listeners. However, if there is no ServletHandler, the ContextHandler will call this method during doStart().- Throws:
Exception
-
contextDestroyed
Call the ServletContextListeners with contextDestroyed. This method can be called from a ServletHandler in the proper sequence of destroying filters, servlets and listeners. If there is no ServletHandler, the ContextHandler must ensure these listeners are called instead.- Throws:
Exception
-
requestInitialized
protected void requestInitialized(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) -
requestDestroyed
protected void requestDestroyed(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) -
setDefaultRequestCharacterEncoding
-
getDefaultRequestCharacterEncoding
-
setDefaultResponseCharacterEncoding
-
getDefaultResponseCharacterEncoding
-
setContextPath
- Overrides:
setContextPath
in classContextHandler
- Parameters:
contextPath
- The _contextPath to set.
-
setWelcomeFiles
-
getWelcomeFiles
@ManagedAttribute(value="Partial URIs of directory welcome files", readonly=true) public String[] getWelcomeFiles()- Returns:
- The names of the files which the server should consider to be welcome files in this context.
- See Also:
-
getMaxFormContentSize
-
setMaxFormContentSize
public void setMaxFormContentSize(int maxSize) Set the maximum size of a form post, to protect against DOS attacks from large forms.- Parameters:
maxSize
- the maximum size of the form content (in bytes)
-
getMaxFormKeys
public int getMaxFormKeys() -
setMaxFormKeys
public void setMaxFormKeys(int max) Set the maximum number of form Keys to protect against DOS attack from crafted hash keys.- Parameters:
max
- the maximum number of form keys
-
loadClass
- Throws:
ClassNotFoundException
-
addLocaleEncoding
-
getLocaleEncoding
-
getLocaleEncoding
Get the character encoding for a locale. The full locale name is first looked up in the map of encodings. If no encoding is found, then the locale language is looked up.- Parameters:
locale
- aLocale
value- Returns:
- a
String
representing the character encoding for the locale or null if none found.
-
getLocaleEncodings
Get all of the locale encodings- Returns:
- a map of all the locale encodings: key is name of the locale and value is the char encoding
-
getResource
Attempt to get a Resource from the Context.- Parameters:
pathInContext
- the path within the base resource to attempt to get- Returns:
- the resource, or null if not available.
- Throws:
MalformedURLException
- if unable to form a Resource from the provided path
-
newResource
Convert URL to Resource wrapper forResourceFactory.newResource(URL)
enables extensions to provide alternate resource implementations.- Parameters:
url
- the url to convert to a Resource- Returns:
- the Resource for that url
- Throws:
IOException
- if unable to create a Resource from the URL
-
newResource
Convert URL to Resource wrapper forResourceFactory.newResource(URL)
enables extensions to provide alternate resource implementations.- Parameters:
uri
- the URI to convert to a Resource- Returns:
- the Resource for that URI
-
newResource
Convert a URL or path to a Resource. The default implementation is a wrapper forResourceFactory.newResource(String)
.- Parameters:
urlOrPath
- The URL or path to convert- Returns:
- The Resource for the URL/path
-
getResourcePaths
-
getServletContext
public jakarta.servlet.ServletContext getServletContext() -
newContext
- Overrides:
newContext
in classContextHandler
-
getContext
- Overrides:
getContext
in classContextHandler
-
addEventListener
Add a context event listeners.- Specified by:
addEventListener
in interfaceContainer
- Specified by:
addEventListener
in interfaceLifeCycle
- Overrides:
addEventListener
in classContextHandler
- Parameters:
listener
- the event listener to add- Returns:
- true if the listener was added
- See Also:
-
HttpSessionAttributeListener
HttpSessionActivationListener
HttpSessionBindingListener
HttpSessionListener
HttpSessionIdListener
ServletContextHandler.ServletContextScopeListener
ServletContextListener
ServletContextAttributeListener
ServletRequestListener
ServletRequestAttributeListener
ContextHandler.addEventListener(EventListener)
-
setHandler
- Specified by:
setHandler
in interfaceHandler.Singleton
- Overrides:
setHandler
in classHandler.Wrapper
- Parameters:
handler
- TheHandler
to set as a child
-
doStart
Description copied from class:ContainerLifeCycle
Starts the managed lifecycle beans in the order they were added.- Overrides:
doStart
in classContextHandler
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:ContainerLifeCycle
Stops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStop
in classContextHandler
- Throws:
Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
newServletContextRequest
protected ServletContextRequest newServletContextRequest(ServletChannel servletChannel, Request request, Response response, String decodedPathInContext, MatchedResource<ServletHandler.MappedServlet> matchedResource) -
wrapRequest
- Overrides:
wrapRequest
in classContextHandler
-
wrapResponse
- Overrides:
wrapResponse
in classContextHandler
-
handleByContextHandler
protected boolean handleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) - Overrides:
handleByContextHandler
in classContextHandler
-
notifyEnterScope
- Overrides:
notifyEnterScope
in classContextHandler
- Parameters:
request
- A request that is applicable to the scope, or null
-
notifyExitScope
- Overrides:
notifyExitScope
in classContextHandler
- Parameters:
request
- A request that is applicable to the scope, or null
-
getDefaultSecurityHandlerClass
Get the defaultSecurityHandlerClass.- Returns:
- the defaultSecurityHandlerClass
-
setDefaultSecurityHandlerClass
public void setDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass) Set the defaultSecurityHandlerClass.- Parameters:
defaultSecurityHandlerClass
- the defaultSecurityHandlerClass to set
-
newSessionHandler
-
newSecurityHandler
-
newServletHandler
-
startContext
Finish constructing handlers and link them together.- Throws:
Exception
-
stopContext
- Throws:
Exception
-
getSecurityHandler
@ManagedAttribute(value="context security handler", readonly=true) public SecurityHandler getSecurityHandler()- Returns:
- Returns the securityHandler.
-
getServletHandler
@ManagedAttribute(value="context servlet handler", readonly=true) public ServletHandler getServletHandler()- Returns:
- Returns the servletHandler.
-
getSessionHandler
@ManagedAttribute(value="context session handler", readonly=true) public SessionHandler getSessionHandler()- Returns:
- Returns the sessionHandler.
-
addServlet
Convenience method to add a servlet.- Parameters:
className
- the servlet class namepathSpec
- the path spec to map servlet to- Returns:
- the ServletHolder for the added servlet
-
addServlet
Convenience method to add a servlet.- Parameters:
servlet
- the servlet classpathSpec
- the path spec to map servlet to- Returns:
- the ServletHolder for the added servlet
-
addServlet
Convenience method to add a servlet.- Parameters:
servlet
- the servlet holderpathSpec
- the path spec
-
addServlet
Convenience method to add a servlet.- Parameters:
servlet
- the servlet instancepathSpec
- the path spec- Returns:
- the ServletHolder for the added servlet
-
addFilter
public void addFilter(FilterHolder holder, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filter- Parameters:
holder
- the filter holderpathSpec
- the path specdispatches
- the dispatcher types for this filter
-
addFilter
public FilterHolder addFilter(Class<? extends jakarta.servlet.Filter> filterClass, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filter- Parameters:
filterClass
- the filter classpathSpec
- the path specdispatches
- the dispatcher types for this filter- Returns:
- the FilterHolder that was created
-
addFilter
public FilterHolder addFilter(String filterClass, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filter- Parameters:
filterClass
- the filter class namepathSpec
- the path specdispatches
- the dispatcher types for this filter- Returns:
- the FilterHolder that was created
-
addFilter
public FilterHolder addFilter(jakarta.servlet.Filter filter, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a servlet.- Parameters:
filter
- the filter instancepathSpec
- the path specdispatches
- the dispatcher types for this filter- Returns:
- the FilterHolder that was created
-
addServletContainerInitializer
public ServletContainerInitializerHolder addServletContainerInitializer(jakarta.servlet.ServletContainerInitializer sci) Convenience method to programmatically add aServletContainerInitializer
.- Parameters:
sci
- the ServletContainerInitializer to register.- Returns:
- the ServletContainerInitializerHolder that was created
-
addServletContainerInitializer
public ServletContainerInitializerHolder addServletContainerInitializer(jakarta.servlet.ServletContainerInitializer sci, Class<?>... classes) Convenience method to programmatically add aServletContainerInitializer
.- Parameters:
sci
- the ServletContainerInitializer to register.classes
- the Set of application classes.- Returns:
- the ServletContainerInitializerHolder that was created
-
addServletContainerInitializer
Convenience method to programmatically add a list ofServletContainerInitializer
. The initializers are guaranteed to be called in the order they are passed into this method.- Parameters:
sciHolders
- the ServletContainerInitializerHolders
-
dynamicHolderAdded
notification that a ServletRegistration has been created so we can track the annotations- Parameters:
holder
- new holder created through the api.- Returns:
- the ServletRegistration.Dynamic
-
addRoles
delegate for ServletContext.declareRole method- Parameters:
roleNames
- role names to add
-
setServletSecurity
public Set<String> setServletSecurity(jakarta.servlet.ServletRegistration.Dynamic registration, jakarta.servlet.ServletSecurityElement servletSecurityElement) Delegate for ServletRegistration.Dynamic.setServletSecurity method- Parameters:
registration
- ServletRegistration.Dynamic instance that setServletSecurity was called onservletSecurityElement
- new security info- Returns:
- the set of exact URL mappings currently associated with the registration that are also present in the web.xml security constraints and thus will be unaffected by this call.
-
callContextInitialized
public void callContextInitialized(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) -
callContextDestroyed
public void callContextDestroyed(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) -
setSessionHandler
- Parameters:
sessionHandler
- The sessionHandler to set.
-
setSecurityHandler
- Parameters:
securityHandler
- TheSecurityHandler
to set on this context.
-
setServletHandler
- Parameters:
servletHandler
- The servletHandler to set.
-
insertHandler
Insert a HandlerWrapper before the first Session, Security or ServletHandler but after any other HandlerWrappers.- Parameters:
handler
- theHandler
to insert
-
getObjectFactory
The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)- Returns:
- The DecoratedObjectFactory
-
ENVIRONMENT
instead.