- All Superinterfaces:
jakarta.servlet.ServletContext
- All Known Implementing Classes:
DefaultWebApplication
,MicroWebApplication
,PlatofmrWebApplication
,ServerWebApplication
,ServerWebApplication
public interface WebApplication
extends jakarta.servlet.ServletContext
The WebApplication API.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Fields inherited from interface jakarta.servlet.ServletContext
ORDERED_LIBS, TEMPDIR
-
Method Summary
Modifier and TypeMethodDescriptionaddFilterMapping
(String filterName, boolean isMatchAfter, String... urlPatterns) Add a mapping for the given filter.addFilterMapping
(String filterName, String... urlPatterns) Add a mapping for the given filter.addFilterMapping
(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, boolean isMatchAfter, String... urlPatterns) Add a mapping for the given filter.void
addInitializer
(jakarta.servlet.ServletContainerInitializer servletContainerInitializer) Add a servlet container initializer.void
addInitializer
(String className) Add a servlet container initializer.void
addResource
(Resource resource) Add the resource.addServletMapping
(String servletName, String... urlPatterns) Add a mapping for the given servlet.void
destroy()
Destroy the web application.jakarta.servlet.Servlet
Get the default servlet.List<jakarta.servlet.ServletContainerInitializer>
Gets the ServletContainerInitializersGet the web application manager.getMappings
(String servletName) Get the mappings for a particular servlet.jakarta.servlet.ServletRequest
getRequest
(jakarta.servlet.ServletResponse response) Get the request.jakarta.servlet.ServletResponse
getResponse
(jakarta.servlet.ServletRequest request) Get the response.default String
Returns the unique Id of this web application corresponding to this ServletContext.void
Initialize the web application.void
Marks the end of initializing declared (web.xml, annotations) artifactsvoid
Initialize the filters.void
Finish the initialization.void
Initialize the servlet container initializers.void
Initialize the servlets.boolean
Is the application distributable.boolean
Is the web application initialized.boolean
Is the web application metadata complete.boolean
Is the web application currently servicing requests.void
linkRequestAndResponse
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Link the request and response.removeServletMapping
(String urlPattern) Remove a mapping for a servlet.void
service
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Service the request.void
setClassLoader
(ClassLoader classLoader) Set the class loader.void
setContextPath
(String contextPath) Set the context path.void
setDefaultServlet
(jakarta.servlet.Servlet defaultServlet) Set the default servlet.void
setDistributable
(boolean distributable) Set if the web application is distributable.void
setEffectiveMajorVersion
(int version) Set the effective major version.void
setEffectiveMinorVersion
(int version) Set the effective minor version.void
setJspConfigDescriptor
(jakarta.servlet.descriptor.JspConfigDescriptor descriptor) Set the JSP config descriptor.void
setMetadataComplete
(boolean metadataComplete) Set the metadata complete flag.void
setServletContextName
(String servletContextName) Set the servlet context name.void
setVirtualServerName
(String virtualServerName) Set the virtual server name.void
setWebApplicationRequestMapper
(WebApplicationRequestMapper webApplicationRequestMapper) Set the web application request mapper.void
start()
Start servicing.void
stop()
Stop servicing.void
unlinkRequestAndResponse
(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Unlink the request and response.Methods inherited from interface jakarta.servlet.ServletContext
addFilter, addFilter, addFilter, addJspFile, addListener, addListener, addListener, addServlet, addServlet, addServlet, createFilter, createListener, createServlet, declareRoles, getAttribute, getAttributeNames, getClassLoader, getContext, getContextPath, getDefaultSessionTrackingModes, getEffectiveMajorVersion, getEffectiveMinorVersion, getEffectiveSessionTrackingModes, getFilterRegistration, getFilterRegistrations, getInitParameter, getInitParameterNames, getJspConfigDescriptor, getMajorVersion, getMimeType, getMinorVersion, getNamedDispatcher, getRealPath, getRequestCharacterEncoding, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getResponseCharacterEncoding, getServerInfo, getServletContextName, getServletRegistration, getServletRegistrations, getSessionCookieConfig, getSessionTimeout, getVirtualServerName, log, log, removeAttribute, setAttribute, setInitParameter, setRequestCharacterEncoding, setResponseCharacterEncoding, setSessionTimeout, setSessionTrackingModes
-
Method Details
-
addFilterMapping
Add a mapping for the given filter.- Parameters:
filterName
- the filter name.urlPatterns
- the URL patterns.- Returns:
- the possible empty set of already mapped URL patterns.
- See Also:
-
FilterRegistration.addMappingForUrlPatterns(EnumSet, boolean, String...)
-
addFilterMapping
default Set<String> addFilterMapping(String filterName, boolean isMatchAfter, String... urlPatterns) Add a mapping for the given filter.- Parameters:
filterName
- the filter name.isMatchAfter
- true to call the filter this mapping applies to after declared ones, false to call it before declared ones.urlPatterns
- the URL patterns.- Returns:
- the possible empty set of already mapped URL patterns.
- See Also:
-
FilterRegistration.addMappingForUrlPatterns(EnumSet, boolean, String...)
-
addFilterMapping
Set<String> addFilterMapping(Set<jakarta.servlet.DispatcherType> dispatcherTypes, String filterName, boolean isMatchAfter, String... urlPatterns) Add a mapping for the given filter.- Parameters:
dispatcherTypes
- the dispatcher types. Can be null to use default DispatcherType.REQUEST.filterName
- the filter name.isMatchAfter
- true to call the filter this mapping applies to after declared ones, false to call it before declared ones.urlPatterns
- the URL patterns.- Returns:
- the possible empty set of already mapped URL patterns.
- See Also:
-
FilterRegistration.addMappingForUrlPatterns(EnumSet, boolean, String...)
-
addInitializer
Add a servlet container initializer.- Parameters:
className
- the class name.
-
addInitializer
void addInitializer(jakarta.servlet.ServletContainerInitializer servletContainerInitializer) Add a servlet container initializer.- Parameters:
servletContainerInitializer
- the servletContainerInitializer instance
-
addResource
Add the resource.- Parameters:
resource
- the resouce.
-
addServletMapping
Add a mapping for the given servlet.- Parameters:
servletName
- the servlet name.urlPatterns
- the URL patterns.- Returns:
- the possible empty set of already mapped URL patterns.
- See Also:
-
ServletRegistration.addMapping(String...)
-
destroy
void destroy()Destroy the web application. -
getDefaultServlet
jakarta.servlet.Servlet getDefaultServlet()Get the default servlet.- Returns:
- the default Servlet.
-
getInitializers
List<jakarta.servlet.ServletContainerInitializer> getInitializers()Gets the ServletContainerInitializers- Returns:
- list of ServletContainerInitializers
-
getManager
WebApplicationManager getManager()Get the web application manager.- Returns:
- the web application manager.
-
getMappings
Get the mappings for a particular servlet.- Parameters:
servletName
- the servlet name.- Returns:
- the possible empty set of mapped URL patterns.
- See Also:
-
ServletRegistration.getMappings()
-
getRequest
jakarta.servlet.ServletRequest getRequest(jakarta.servlet.ServletResponse response) Get the request.- Parameters:
response
- the response.- Returns:
- the request.
-
getResponse
jakarta.servlet.ServletResponse getResponse(jakarta.servlet.ServletRequest request) Get the response.- Parameters:
request
- the request.- Returns:
- the response.
-
getServletContextId
Returns the unique Id of this web application corresponding to this ServletContext.- Returns:
- the servlet context id.
-
initialize
void initialize()Initialize the web application. -
initializeDeclaredFinish
void initializeDeclaredFinish()Marks the end of initializing declared (web.xml, annotations) artifacts -
initializeFilters
void initializeFilters()Initialize the filters. -
initializeFinish
void initializeFinish()Finish the initialization. -
initializeInitializers
void initializeInitializers()Initialize the servlet container initializers. -
initializeServlets
void initializeServlets()Initialize the servlets. -
isDistributable
boolean isDistributable()Is the application distributable.- Returns:
- true if it is, false otherwise.
-
isInitialized
boolean isInitialized()Is the web application initialized.- Returns:
- true if it is, false otherwise.
-
isMetadataComplete
boolean isMetadataComplete()Is the web application metadata complete.- Returns:
- true if it is, false otherwise.
-
isServicing
boolean isServicing()Is the web application currently servicing requests.- Returns:
- true if it is, false otherwise.
-
linkRequestAndResponse
void linkRequestAndResponse(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Link the request and response.- Parameters:
request
- the request.response
- the response.
-
removeServletMapping
Remove a mapping for a servlet.- Parameters:
urlPattern
- the URL pattern- Returns:
- the Servlet name the pattern was mapped to, or null if no prior mapping.
-
service
void service(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws jakarta.servlet.ServletException, IOException Service the request.- Parameters:
request
- the request.response
- the response.- Throws:
jakarta.servlet.ServletException
- when a servlet error occurs.IOException
- when an I/O error occurs.
-
setClassLoader
Set the class loader.- Parameters:
classLoader
- the class loader.
-
setContextPath
Set the context path.- Parameters:
contextPath
- the context path.
-
setDefaultServlet
void setDefaultServlet(jakarta.servlet.Servlet defaultServlet) Set the default servlet.- Parameters:
defaultServlet
- the default servlet.
-
setDistributable
void setDistributable(boolean distributable) Set if the web application is distributable.- Parameters:
distributable
- the distributable flag.
-
setEffectiveMajorVersion
void setEffectiveMajorVersion(int version) Set the effective major version.- Parameters:
version
- the effective major version.
-
setEffectiveMinorVersion
void setEffectiveMinorVersion(int version) Set the effective minor version.- Parameters:
version
- the effective minor version.
-
setJspConfigDescriptor
void setJspConfigDescriptor(jakarta.servlet.descriptor.JspConfigDescriptor descriptor) Set the JSP config descriptor.- Parameters:
descriptor
- the descriptor.
-
setMetadataComplete
void setMetadataComplete(boolean metadataComplete) Set the metadata complete flag.- Parameters:
metadataComplete
- the metadata complete flag.
-
setServletContextName
Set the servlet context name.- Parameters:
servletContextName
- the servlet context name.
-
setVirtualServerName
Set the virtual server name.- Parameters:
virtualServerName
- the virtual server name.
-
setWebApplicationRequestMapper
Set the web application request mapper.- Parameters:
webApplicationRequestMapper
- the web application request mapper.
-
start
void start()Start servicing. -
stop
void stop()Stop servicing. -
unlinkRequestAndResponse
void unlinkRequestAndResponse(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) Unlink the request and response.- Parameters:
request
- the request.response
- the response.
-