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
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classstatic classstatic interfacestatic classBean that is added to the ServletContextHandler to start all of the ServletContainerInitializers by starting their corresponding ServletContainerInitializerHolders when this bean is itself started.classstatic interfaceListener for all threads entering context scope, including async IO callbacksstatic interfaceThe interface used byServletApiRequestto access theServletContextRequestwithout access to the unwrappedRequestmethods.static interfaceThe interface used byServletApiResponseto access theServletContextResponsewithout access to the unwrappedResponsemethods.classstatic classNested classes/interfaces inherited from class ContextHandler
ContextHandler.Availability, ContextHandler.ContextScopeListener, ContextHandler.ScopedContextNested classes/interfaces inherited from class Handler.Abstract
Handler.Abstract.NonBlockingNested classes/interfaces inherited from class AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopExceptionNested classes/interfaces inherited from interface Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.WrapperNested classes/interfaces inherited from interface Container
Container.InheritedListener, Container.ListenerNested classes/interfaces inherited from interface Dumpable
Dumpable.DumpableContainerNested classes/interfaces inherited from interface Handler
Handler.Abstract, Handler.AbstractContainer, Handler.Collection, Handler.Container, Handler.Sequence, Handler.Singleton, Handler.WrapperNested classes/interfaces inherited from interface Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.TaskNested classes/interfaces inherited from interface LifeCycle
LifeCycle.ListenerNested classes/interfaces inherited from interface Request.Handler
Request.Handler.AbortException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EnvironmentDeprecated, for removal: This API element is subject to removal in a future version.protected ServletContextHandler.ContextStatusprotected jakarta.servlet.descriptor.JspConfigDescriptorprotected final DecoratedObjectFactoryprotected intprotected SecurityHandlerprotected ServletHandlerprotected SessionHandlerstatic final intstatic final intstatic final intstatic final Environmentstatic final intstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final Class<?>[]static final intFields inherited from class ContextHandler
CROSS_CONTEXT_ATTRIBUTE, MANAGED_ATTRIBUTESFields inherited from interface Attributes
NULLFields inherited from interface Invocable
__nonBlocking, NOOP -
Constructor Summary
ConstructorsConstructorDescriptionServletContextHandler(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 TypeMethodDescriptionbooleanaddEventListener(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 filtervoidaddFilter(FilterHolder holder, String pathSpec, EnumSet<jakarta.servlet.DispatcherType> dispatches) Convenience method to add a filtervoidaddLocaleEncoding(String locale, String encoding) protected voidaddProgrammaticListener(EventListener listener) Apply any necessary restrictions on a programmatic added listener.protected voiddelegate 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.voidaddServlet(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.voidaddServletContainerInitializer(ServletContainerInitializerHolder... sciHolders) Convenience method to programmatically add a list ofServletContainerInitializer.voidcallContextDestroyed(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) voidcallContextInitialized(jakarta.servlet.ServletContextListener l, jakarta.servlet.ServletContextEvent e) voidCall the ServletContextListeners with contextDestroyed.voidCall the ServletContextListeners contextInitialized methods.protected voiddoStart()Starts the managed lifecycle beans in the order they were added.protected voiddoStop()Stops the managed lifecycle beans in the reverse order they were added.voiddump(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.protected jakarta.servlet.ServletRegistration.DynamicdynamicHolderAdded(ServletHolder holder) notification that a ServletRegistration has been created so we can track the annotationsstatic jakarta.servlet.ServletContextstatic ServletContextHandlerClass<? 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.LoggerintintThe 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.ServletContextstatic jakarta.servlet.ServletContextgetServletContext(Context context) static ServletContextHandlergetServletContextHandler(jakarta.servlet.ServletContext servletContext) static ServletContextHandlergetServletContextHandler(jakarta.servlet.ServletContext servletContext, String purpose) String[]protected booleanhandleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) voidinsertHandler(Handler.Singleton handler) Insert a HandlerWrapper before the first Session, Security or ServletHandler but after any other HandlerWrappers.booleanisDurableListener(EventListener listener) booleanisProgrammaticListener(EventListener listener) booleanClass<?> protected ContextHandler.ScopedContextnewResource(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 SecurityHandlerprotected ServletContextRequestnewServletContextRequest(ServletChannel servletChannel, Request request, Response response, String decodedPathInContext, MatchedResource<ServletHandler.MappedServlet> matchedResource) protected ServletHandlerprotected SessionHandlerprotected voidnotifyEnterScope(Request request) protected voidnotifyExitScope(Request request) booleanremoveEventListener(EventListener listener) Remove an event listener.protected voidrequestDestroyed(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) protected voidrequestInitialized(Request baseRequest, jakarta.servlet.http.HttpServletRequest request) voidsetContextPath(String contextPath) voidsetDefaultRequestCharacterEncoding(String encoding) voidsetDefaultResponseCharacterEncoding(String encoding) voidsetDefaultSecurityHandlerClass(Class<? extends SecurityHandler> defaultSecurityHandlerClass) Set the defaultSecurityHandlerClass.voidsetHandler(Handler handler) setInitParameter(String name, String value) voidsetLogger(org.slf4j.Logger logger) voidsetMaxFormContentSize(int maxSize) Set the maximum size of a form post, to protect against DOS attacks from large forms.voidsetMaxFormKeys(int max) Set the maximum number of form Keys to protect against DOS attack from crafted hash keys.voidsetSecurityHandler(SecurityHandler securityHandler) voidsetServletHandler(ServletHandler servletHandler) setServletSecurity(jakarta.servlet.ServletRegistration.Dynamic registration, jakarta.servlet.ServletSecurityElement servletSecurityElement) Delegate for ServletRegistration.Dynamic.setServletSecurity methodvoidsetSessionHandler(SessionHandler sessionHandler) voidsetTempDirectory(File tempDirectory) Set the temporary directory returned byContextHandler.ScopedContext.getTempDirectory().voidsetUsingSecurityManager(boolean usingSecurityManager) voidsetWelcomeFiles(String[] files) protected voidFinish constructing handlers and link them together.protected voidprotected ContextRequestwrapRequest(Request request, Response response) protected ContextResponsewrapResponse(ContextRequest request, Response response) Methods inherited from class 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, toStringMethods inherited from class Handler.Wrapper
getHandlerMethods inherited from class Handler.AbstractContainer
findContainerOf, getDescendant, getDescendants, isDynamic, setDynamicMethods inherited from class Handler.Abstract
getServerMethods inherited from class 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, updateBeansMethods inherited from class AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Attributes
asAttributeMap, equals, hashCodeMethods inherited from interface Container
getCachedBeans, getEventListenersMethods inherited from interface Dumpable.DumpableContainer
isDumpableMethods inherited from interface Handler.Container
getContainer, getDescendant, getDescendants, getDescendantsMethods inherited from interface Handler.Singleton
getHandlers, getTail, setHandlerMethods inherited from interface 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.UseENVIRONMENTinstead. -
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:ContextHandlerSet 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 anyFileset here will be deleted and recreated as a directory duringAbstractLifeCycle.start()and will be deleted duringAbstractLifeCycle.stop().- Overrides:
setTempDirectoryin 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:
getInvocationTypein interfaceInvocable- Specified by:
getInvocationTypein interfaceRequest.Handler- Overrides:
getInvocationTypein classHandler.Wrapper- Returns:
- The InvocationType of this object
-
dump
Description copied from interface:DumpableDump 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:
dumpin interfaceDumpable- Overrides:
dumpin 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:ContainerRemove an event listener.- Specified by:
removeEventListenerin interfaceContainer- Specified by:
removeEventListenerin interfaceLifeCycle- Overrides:
removeEventListenerin 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:
setContextPathin 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- aLocalevalue- Returns:
- a
Stringrepresenting the character encoding for the locale or null if none found.
-
getLocaleEncodings
-
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:
newContextin classContextHandler
-
getContext
- Overrides:
getContextin classContextHandler
-
addEventListener
Add a context event listeners.- Specified by:
addEventListenerin interfaceContainer- Specified by:
addEventListenerin interfaceLifeCycle- Overrides:
addEventListenerin classContextHandler- Parameters:
listener- the event listener to add- Returns:
- true if the listener was added
- See Also:
-
setHandler
- Specified by:
setHandlerin interfaceHandler.Singleton- Overrides:
setHandlerin classHandler.Wrapper- Parameters:
handler- TheHandlerto set as a child
-
doStart
Description copied from class:ContainerLifeCycleStarts the managed lifecycle beans in the order they were added.- Overrides:
doStartin classContextHandler- Throws:
Exception- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
Description copied from class:ContainerLifeCycleStops the managed lifecycle beans in the reverse order they were added.- Overrides:
doStopin 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:
wrapRequestin classContextHandler
-
wrapResponse
- Overrides:
wrapResponsein classContextHandler
-
handleByContextHandler
protected boolean handleByContextHandler(String pathInContext, ContextRequest request, Response response, Callback callback) - Overrides:
handleByContextHandlerin classContextHandler
-
notifyEnterScope
- Overrides:
notifyEnterScopein classContextHandler- Parameters:
request- A request that is applicable to the scope, or null
-
notifyExitScope
- Overrides:
notifyExitScopein 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
-
stopContext
-
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- TheSecurityHandlerto 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- theHandlerto insert
-
getObjectFactory
The DecoratedObjectFactory for use by IoC containers (weld / spring / etc)- Returns:
- The DecoratedObjectFactory
-
ENVIRONMENTinstead.