- All Superinterfaces:
ServletContext
- All Known Implementing Classes:
DefaultWebApplication
,MicroWebApplication
public interface WebApplication extends ServletContext
The WebApplication API.
- Author:
- Manfred Riem ([email protected])
-
Field Summary
Fields inherited from interface javax.servlet.ServletContext
ORDERED_LIBS, TEMPDIR
-
Method Summary
Modifier and Type Method Description void
addErrorPage(int code, java.lang.String location)
Adds an error page to be forwarded to on the given HTTP status codevoid
addErrorPage(java.lang.String exception, java.lang.String location)
Adds an error page to be forwarded to on the given exceptiondefault java.util.Set<java.lang.String>
addFilterMapping(java.lang.String filterName, boolean isMatchAfter, java.lang.String... urlPatterns)
Add a mapping for the given filter.default java.util.Set<java.lang.String>
addFilterMapping(java.lang.String filterName, java.lang.String... urlPatterns)
Add a mapping for the given filter.java.util.Set<java.lang.String>
addFilterMapping(java.util.Set<DispatcherType> dispatcherTypes, java.lang.String filterName, boolean isMatchAfter, java.lang.String... urlPatterns)
Add a mapping for the given filter.void
addInitializer(java.lang.String className)
Add a servlet container initializer.void
addInitializer(ServletContainerInitializer servletContainerInitializer)
Add a servlet container initializer.void
addResource(Resource resource)
Add the resource.java.util.Set<java.lang.String>
addServletMapping(java.lang.String servletName, java.lang.String... urlPatterns)
Add a mapping for the given servlet.void
destroy()
Destroy the web application.AnnotationManager
getAnnotationManager()
Gets the annotation manager.AsyncManager
getAsyncManager()
Get the async manager.Servlet
getDefaultServlet()
Get the default Servlet.boolean
getDenyUncoveredHttpMethods()
Are we denying uncovered HTTP methods.HttpRequestManager
getHttpRequestManager()
Get the HttpRequestManager.HttpSessionManager
getHttpSessionManager()
Get the HttpSessionManager.java.util.List<ServletContainerInitializer>
getInitializers()
Gets the ServletContainerInitializersLocaleEncodingManager
getLocaleEncodingManager()
Get the locale encoding managerjava.util.Collection<java.lang.String>
getMappings(java.lang.String servletName)
Get the mappings for a particular servlet.MimeTypeManager
getMimeTypeManager()
Get the mime type manager.MultiPartManager
getMultiPartManager()
Get the multi part manager.NamingManager
getNamingManager()
Get the naming manager.ObjectInstanceManager
getObjectInstanceManager()
Get the object instance manager.PolicyManager
getPolicyManager()
Get the policy manager.ServletRequest
getRequest(ServletResponse response)
Get the associated request.ServletResponse
getResponse(ServletRequest request)
Get the associated response.SecurityManager
getSecurityManager()
Get the security manager.default java.lang.String
getServletContextId()
Returns the unique Id of this web application corresponding to this ServletContext.WelcomeFileManager
getWelcomeFileManager()
Get the welcome file manager.void
initialize()
Initialize the web application.void
initializeDeclaredFinish()
Marks the end of initializing declared (web.xml, annotations) artifactsvoid
initializeFilters()
Initialize the filters.void
initializeFinish()
Finish the initialization.void
initializeInitializers()
Initialize the servlet container initializers.void
initializeServlets()
Initialize the servlets.boolean
isDistributable()
Is the application distributable.boolean
isInitialized()
Is the web application initialized.void
linkRequestAndResponse(ServletRequest request, ServletResponse response)
Link the request and response.void
service(ServletRequest request, ServletResponse response)
Service the request.void
setAnnotationManager(AnnotationManager annotationManager)
Sets the annotation manager.void
setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader.void
setContextPath(java.lang.String contextPath)
Set the context path.void
setDefaultServlet(Servlet defaultServlet)
Set the default servlet.void
setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)
Set if we are denying uncovered HTTP methods.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
setHttpRequestManager(HttpRequestManager httpRequestManager)
Set the HTTP request manager.void
setHttpSessionManager(HttpSessionManager httpSessionManager)
Set the HTTP session manager.void
setJspManager(JspManager jspManager)
Set the JSP manager.void
setLocaleEncodingManager(LocaleEncodingManager localeEncodingManager)
Set the locale encoding managervoid
setLoggingManager(LoggingManager loggingManager)
Set the logging manager.void
setMimeTypeManager(MimeTypeManager mimeTypeManager)
Set the mimeType manager.void
setMultiPartManager(MultiPartManager multiPartManager)
Set the multi part manager.void
setNamingManager(NamingManager namingManager)
Set the naming manager.void
setObjectInstanceManager(ObjectInstanceManager objectInstanceManager)
Set the object instance manager.void
setResourceManager(ResourceManager resourceManager)
Set the resource manager.void
setSecurityManager(SecurityManager securityManager)
Set the security manager.void
setServletContextName(java.lang.String servletContextName)
Set the servlet context name.void
setWebApplicationRequestMapper(WebApplicationRequestMapper webApplicationRequestMapper)
Set the web application request mapper.void
setWelcomeFileManager(WelcomeFileManager welcomeFileManager)
Set the welcome file manager.void
start()
Start servicing.void
stop()
Stop servicing.void
unlinkRequestAndResponse(ServletRequest request, ServletResponse response)
Unlink the request and response.Methods inherited from interface javax.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, getServlet, getServletContextName, getServletNames, getServletRegistration, getServletRegistrations, getServlets, getSessionCookieConfig, getSessionTimeout, getVirtualServerName, log, log, log, removeAttribute, setAttribute, setInitParameter, setRequestCharacterEncoding, setResponseCharacterEncoding, setSessionTimeout, setSessionTrackingModes
-
Method Details
-
addErrorPage
void addErrorPage(int code, java.lang.String location)Adds an error page to be forwarded to on the given HTTP status code- Parameters:
code
- the HTTP code for which the error page is to be invokedlocation
- the location of the error page
-
addErrorPage
void addErrorPage(java.lang.String exception, java.lang.String location)Adds an error page to be forwarded to on the given exception- Parameters:
exception
- the exception for which the error page is to be invokedlocation
- the location of the error page
-
addFilterMapping
default java.util.Set<java.lang.String> addFilterMapping(java.lang.String filterName, java.lang.String... urlPatterns)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 java.util.Set<java.lang.String> addFilterMapping(java.lang.String filterName, boolean isMatchAfter, java.lang.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
java.util.Set<java.lang.String> addFilterMapping(java.util.Set<DispatcherType> dispatcherTypes, java.lang.String filterName, boolean isMatchAfter, java.lang.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
void addInitializer(java.lang.String className)Add a servlet container initializer.- Parameters:
className
- the class name.
-
addInitializer
Add a servlet container initializer.- Parameters:
servletContainerInitializer
- the servletContainerInitializer instance
-
addResource
Add the resource.- Parameters:
resource
- the resouce.
-
addServletMapping
java.util.Set<java.lang.String> addServletMapping(java.lang.String servletName, java.lang.String... urlPatterns)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. -
getAnnotationManager
AnnotationManager getAnnotationManager()Gets the annotation manager.- Returns:
- the annotation manager.
-
getAsyncManager
AsyncManager getAsyncManager()Get the async manager.- Returns:
- the async manager.
-
getDefaultServlet
Servlet getDefaultServlet()Get the default Servlet.- Returns:
- the default Servlet.
-
getDenyUncoveredHttpMethods
boolean getDenyUncoveredHttpMethods()Are we denying uncovered HTTP methods.- Returns:
- true if we are, false otherwise.
-
getMimeTypeManager
MimeTypeManager getMimeTypeManager()Get the mime type manager.- Returns:
- the mime type manager.
-
getMultiPartManager
MultiPartManager getMultiPartManager()Get the multi part manager.- Returns:
- the multi part manager.
-
getNamingManager
NamingManager getNamingManager()Get the naming manager.- Returns:
- the naming manager.
-
getPolicyManager
PolicyManager getPolicyManager()Get the policy manager.- Returns:
- the policy manager.
-
getServletContextId
default java.lang.String getServletContextId()Returns the unique Id of this web application corresponding to this ServletContext.- Returns:
- the servlet context id.
-
getHttpSessionManager
HttpSessionManager getHttpSessionManager()Get the HttpSessionManager.- Returns:
- the HttpSessionManager.
-
getHttpRequestManager
HttpRequestManager getHttpRequestManager()Get the HttpRequestManager.- Returns:
- the HttpRequestManager.
-
getInitializers
java.util.List<ServletContainerInitializer> getInitializers()Gets the ServletContainerInitializers- Returns:
- list of ServletContainerInitializers
-
getMappings
java.util.Collection<java.lang.String> getMappings(java.lang.String servletName)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()
-
getObjectInstanceManager
ObjectInstanceManager getObjectInstanceManager()Get the object instance manager.- Returns:
- the DependencyInjectionManager.
-
getRequest
Get the associated request.- Parameters:
response
- the response.- Returns:
- the associated request.
-
getResponse
Get the associated response.- Parameters:
request
- the request.- Returns:
- the associated response.
-
getSecurityManager
SecurityManager getSecurityManager()Get the security manager.- Returns:
- the security manager.
-
getWelcomeFileManager
WelcomeFileManager getWelcomeFileManager()Get the welcome file manager.- Returns:
- the welcome file manager.
-
getLocaleEncodingManager
LocaleEncodingManager getLocaleEncodingManager()Get the locale encoding manager- Returns:
- the locale encoding manager
-
initialize
void initialize()Initialize the web application. -
initializeDeclaredFinish
void initializeDeclaredFinish()Marks the end of initializing declared (web.xml, annotations) artifacts -
initializeFinish
void initializeFinish()Finish the initialization. -
initializeFilters
void initializeFilters()Initialize the filters. -
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.
-
linkRequestAndResponse
Link the request and response.- Parameters:
request
- the request.response
- the response.
-
service
void service(ServletRequest request, ServletResponse response) throws ServletException, java.io.IOExceptionService the request.- Parameters:
request
- the request.response
- the response.- Throws:
ServletException
- when a servlet error occurs.java.io.IOException
- when an I/O error occurs.
-
setClassLoader
void setClassLoader(java.lang.ClassLoader classLoader)Set the class loader.- Parameters:
classLoader
- the class loader.
-
setContextPath
void setContextPath(java.lang.String contextPath)Set the context path.- Parameters:
contextPath
- the context path.
-
setDefaultServlet
Set the default servlet.- Parameters:
defaultServlet
- the default servlet.
-
setDenyUncoveredHttpMethods
void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)Set if we are denying uncovered HTTP methods.- Parameters:
denyUncoveredHttpMethods
- the boolean value.
-
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.
-
setHttpSessionManager
Set the HTTP session manager.- Parameters:
httpSessionManager
- the HTTP session manager.
-
setHttpRequestManager
Set the HTTP request manager.- Parameters:
httpRequestManager
- the HTTP request manager.
-
setJspManager
Set the JSP manager.- Parameters:
jspManager
- the JSP manager.
-
setLoggingManager
Set the logging manager.- Parameters:
loggingManager
- the logging manager.
-
setMimeTypeManager
Set the mimeType manager.- Parameters:
mimeTypeManager
- the mimeType manager.
-
setMultiPartManager
Set the multi part manager.- Parameters:
multiPartManager
- the multi part manager.
-
setNamingManager
Set the naming manager.- Parameters:
namingManager
- the naming manager.
-
setObjectInstanceManager
Set the object instance manager.- Parameters:
objectInstanceManager
- the object instance manager.
-
setResourceManager
Set the resource manager.- Parameters:
resourceManager
- the resource manager.
-
setSecurityManager
Set the security manager.- Parameters:
securityManager
- the security manager.
-
setAnnotationManager
Sets the annotation manager.- Parameters:
annotationManager
- the annotation manager
-
setServletContextName
void setServletContextName(java.lang.String servletContextName)Set the servlet context name.- Parameters:
servletContextName
- the servlet context name.
-
setWebApplicationRequestMapper
Set the web application request mapper.- Parameters:
webApplicationRequestMapper
- the web application request mapper.
-
setWelcomeFileManager
Set the welcome file manager.- Parameters:
welcomeFileManager
- the welcome file manager.
-
setLocaleEncodingManager
Set the locale encoding manager- Parameters:
localeEncodingManager
- the locale encoding manager
-
start
void start()Start servicing. -
stop
void stop()Stop servicing. -
unlinkRequestAndResponse
Unlink the request and response.- Parameters:
request
- the request.response
- the response.
-