Package cloud.piranha.webapp.impl
Class DefaultWebApplication
- java.lang.Object
-
- cloud.piranha.webapp.impl.DefaultWebApplication
-
- All Implemented Interfaces:
WebApplication
,ServletContext
public class DefaultWebApplication extends Object implements WebApplication
The default WebApplication.The
filters
field is backed by a LinkedHashMap so we get an insertion-order key set. If you change this, be aware that methods using this field should be changed to account for that.The
servlets
field is backed by a LinkedHashMap so we get an insertion-order key set. If you change this, be aware that methods using this field should be changed to account for that.- Author:
- Manfred Riem ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationManager
annotationManager
Stores the annotation manager.protected AsyncManager
asyncManager
Stores the async manager.protected Map<String,Object>
attributes
Stores the attributes.protected ClassLoader
classLoader
Stores the class loader.protected List<ServletContextAttributeListener>
contextAttributeListeners
Stores the servlet context attribute listeners.protected ArrayList<ServletContextListener>
contextListeners
Stores the servlet context listeners.protected String
contextPath
Stores the context path.protected Servlet
defaultServlet
Stores the default servlet (if any).protected boolean
distributable
Stores the boolean flag indicating if the web application is distributable.protected static int
ERROR
Stores the ERROR constant.protected Map<Integer,String>
errorPagesByCode
protected Map<String,String>
errorPagesByException
protected Map<String,DefaultFilterEnvironment>
filters
Stores the filters.protected HttpRequestManager
httpRequestManager
Stores the request manager.protected HttpSessionManager
httpSessionManager
Stores the session manager.protected static int
INITIALIZED
Stores the INITIALIZED constant.protected List<ServletContainerInitializer>
initializers
Stores the servlet container initializers.protected Map<String,String>
initParameters
Stores the init parameters.protected JspManager
jspManager
Stores the JSP manager.protected LoggingManager
loggingManager
Stores the logging manager.protected MimeTypeManager
mimeTypeManager
Stores the mime type manager.protected MultiPartManager
multiPartManager
Stores the multi part manager.protected ObjectInstanceManager
objectInstanceManager
Stores the object instance manager.protected String
requestCharacterEncoding
Stores the request character encoding.protected List<ServletRequestListener>
requestListeners
Stores the servlet request listeners.protected Map<ServletRequest,ServletResponse>
requests
Stores the active requests and the associated response.protected ResourceManager
resourceManager
Stores the resource manager.protected String
responseCharacterEncoding
Stores the response character encoding.protected Map<ServletResponse,ServletRequest>
responses
Stores the active responses and the associated requests.protected SecurityManager
securityManager
Stores the security manager.protected static int
SERVICING
Stores the SERVICING constant.protected String
servletContextName
Stores the servlet context name.protected Map<String,DefaultServletEnvironment>
servlets
Stores the servlets.protected static int
SETUP
Stores the SETUP constant.protected int
status
Stores the status.protected String
virtualServerName
Stores the virtual server name.protected WebApplicationRequestMapper
webApplicationRequestMapper
Stores the web application request mapper.protected WelcomeFileManager
welcomeFileManager
Stores the welcome file manager.-
Fields inherited from interface javax.servlet.ServletContext
ORDERED_LIBS, TEMPDIR
-
-
Constructor Summary
Constructors Constructor Description DefaultWebApplication()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addErrorPage(int code, String location)
Adds an error page to be forwarded to on the given HTTP status codevoid
addErrorPage(String exception, String location)
Adds an error page to be forwarded to on the given exceptionFilterRegistration.Dynamic
addFilter(String filterName, Class<? extends Filter> filterClass)
Add the filter.FilterRegistration.Dynamic
addFilter(String filterName, String className)
Add the filter.FilterRegistration.Dynamic
addFilter(String filterName, Filter filter)
Add the filter.Set<String>
addFilterMapping(String filterName, boolean isMatchAfter, String... urlPatterns)
Add a mapping for the given filter.Set<String>
addFilterMapping(String filterName, String... urlPatterns)
Add a mapping for the given filter.void
addInitializer(String className)
Add a servlet container initializer.void
addInitializer(ServletContainerInitializer servletContainerInitializer)
Add a servlet container initializer.ServletRegistration.Dynamic
addJspFile(String servletName, String jspFile)
Add a JSP file.void
addListener(Class<? extends EventListener> type)
Add the listener.void
addListener(String className)
Add listener.<T extends EventListener>
voidaddListener(T listener)
Add the listener.void
addResource(Resource resource)
Add the resource.ServletRegistration.Dynamic
addServlet(String servletName, Class<? extends Servlet> servletClass)
Add the servlet.ServletRegistration.Dynamic
addServlet(String servletName, String className)
Add the servlet.ServletRegistration.Dynamic
addServlet(String servletName, Servlet servlet)
Add the servlet.Set<String>
addServletMapping(String servletName, String... urlPatterns)
Add the servlet mapping.<T extends Filter>
TcreateFilter(Class<T> filterClass)
Create the filter.<T extends EventListener>
TcreateListener(Class<T> clazz)
Create the listener.<T extends Servlet>
TcreateServlet(Class<T> servletClass)
Create the servlet.void
declareRoles(String... roles)
Declare roles.void
destroy()
Destroy the web application.protected List<DefaultFilterEnvironment>
findFilterEnvironments(HttpServletRequest request)
Find the filter environments.AnnotationManager
getAnnotationManager()
Gets the annotation manager.AsyncManager
getAsyncManager()
Get the async manager.Object
getAttribute(String name)
Get the attribute.Enumeration<String>
getAttributeNames()
Get the attribute names.ClassLoader
getClassLoader()
Get the class loader.ServletContext
getContext(String uripath)
Get the servlet context for the given uripath.String
getContextPath()
Get the context path.Servlet
getDefaultServlet()
Get the default Servlet.Set<SessionTrackingMode>
getDefaultSessionTrackingModes()
Get the default session tracking modes.boolean
getDenyUncoveredHttpMethods()
Are we denying uncovered HTTP methods.int
getEffectiveMajorVersion()
Get the effective major version.int
getEffectiveMinorVersion()
Get the effective minor version.Set<SessionTrackingMode>
getEffectiveSessionTrackingModes()
Get the effective tracking modes.FilterRegistration
getFilterRegistration(String filterName)
Get the filter registration.Map<String,? extends FilterRegistration>
getFilterRegistrations()
Get the filter registrations.HttpRequestManager
getHttpRequestManager()
Get the HttpRequestManager.HttpSessionManager
getHttpSessionManager()
Get the session manager.String
getInitParameter(String name)
Get the init parameter.Enumeration<String>
getInitParameterNames()
Get the init parameter names.JspConfigDescriptor
getJspConfigDescriptor()
Get the JSP config descriptor.int
getMajorVersion()
Get the major version.Collection<String>
getMappings(String servletName)
Get the servlet mappings for the given servlet.String
getMimeType(String filename)
Get the mime type.MimeTypeManager
getMimeTypeManager()
Get the mime type manager.int
getMinorVersion()
Get the minor version.MultiPartManager
getMultiPartManager()
Get the multi part manager.RequestDispatcher
getNamedDispatcher(String name)
Get the name request dispatcher.protected RequestDispatcher
getNamedDispatcher(String name, String path)
Get the name request dispatcher.ObjectInstanceManager
getObjectInstanceManager()
Get the DependencyInjectionManager.String
getRealPath(String path)
Get the real path.ServletRequest
getRequest(ServletResponse response)
Get the request associated with the response.String
getRequestCharacterEncoding()
Get the default request character encoding.RequestDispatcher
getRequestDispatcher(String path)
Get the request dispatcher.URL
getResource(String location)
Get the resource.InputStream
getResourceAsStream(String location)
Get the resource as a stream.Set<String>
getResourcePaths(String path)
Get the resource paths.ServletResponse
getResponse(ServletRequest request)
Get the response.String
getResponseCharacterEncoding()
Get the default response character encoding.SecurityManager
getSecurityManager()
Get the security manager.String
getServerInfo()
Get the server info.Servlet
getServlet(String name)
Deprecated.String
getServletContextName()
Get the servlet context name (aka display-name).Enumeration<String>
getServletNames()
Deprecated.ServletRegistration
getServletRegistration(String servletName)
Get the servlet registration.Map<String,? extends ServletRegistration>
getServletRegistrations()
Get the servlet registrations.Enumeration<Servlet>
getServlets()
Deprecated.SessionCookieConfig
getSessionCookieConfig()
Get the session cookie config.int
getSessionTimeout()
Get the default session timeout.String
getVirtualServerName()
Get the virtual server name.WelcomeFileManager
getWelcomeFileManager()
Get the welcome file manager.void
initialize()
Initialize the web application.void
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 web application distributable.void
linkRequestAndResponse(ServletRequest request, ServletResponse response)
Link the request and response.void
log(Exception exception, String message)
Deprecated.void
log(String message)
Log a message.void
log(String message, Throwable throwable)
Log a message.void
removeAttribute(String name)
Remove the attribute with the given name.void
service(ServletRequest request, ServletResponse response)
Service the request using this web application.void
setAnnotationManager(AnnotationManager annotationManager)
Sets the annotation manager.void
setAttribute(String name, Object value)
Set the attribute.void
setClassLoader(ClassLoader classLoader)
Set the class-loader.void
setContextPath(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
setHttpRequestManager(HttpRequestManager httpRequestManager)
Set the HTTP request manager.void
setHttpSessionManager(HttpSessionManager httpSessionManager)
Set the HTTP session manager.boolean
setInitParameter(String name, String value)
Set the init parameter.void
setJspManager(JspManager jspManager)
Set the JSP manager.void
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
setObjectInstanceManager(ObjectInstanceManager objectInstanceManager)
Set the object instance manager.void
setRequestCharacterEncoding(String requestCharacterEncoding)
Set the default request character encoding.void
setResourceManager(ResourceManager resourceManager)
Set the resource manager.void
setResponseCharacterEncoding(String responseCharacterEncoding)
Set the default response character encoding.void
setSecurityManager(SecurityManager securityManager)
Set the security manager.void
setServletContextName(String servletContextName)
Set the servlet context name.void
setSessionTimeout(int sessionTimeout)
Set the default session timeout.void
setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
Set the session tracking modes.void
setVirtualServerName(String virtualServerName)
Set the virtual server 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.protected void
verifyState(int desiredStatus, String message)
Verify the web application state.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cloud.piranha.webapp.api.WebApplication
getServletContextId
-
-
-
-
Field Detail
-
INITIALIZED
protected static final int INITIALIZED
Stores the INITIALIZED constant.- See Also:
- Constant Field Values
-
ERROR
protected static final int ERROR
Stores the ERROR constant.- See Also:
- Constant Field Values
-
SETUP
protected static final int SETUP
Stores the SETUP constant.- See Also:
- Constant Field Values
-
SERVICING
protected static final int SERVICING
Stores the SERVICING constant.- See Also:
- Constant Field Values
-
asyncManager
protected AsyncManager asyncManager
Stores the async manager.
-
classLoader
protected ClassLoader classLoader
Stores the class loader.
-
contextPath
protected String contextPath
Stores the context path.
-
defaultServlet
protected Servlet defaultServlet
Stores the default servlet (if any).
-
distributable
protected boolean distributable
Stores the boolean flag indicating if the web application is distributable.
-
servletContextName
protected String servletContextName
Stores the servlet context name.
-
virtualServerName
protected String virtualServerName
Stores the virtual server name.
-
responseCharacterEncoding
protected String responseCharacterEncoding
Stores the response character encoding.
-
status
protected int status
Stores the status.
-
requests
protected final Map<ServletRequest,ServletResponse> requests
Stores the active requests and the associated response.
-
responses
protected final Map<ServletResponse,ServletRequest> responses
Stores the active responses and the associated requests.
-
initializers
protected final List<ServletContainerInitializer> initializers
Stores the servlet container initializers.
-
servlets
protected final Map<String,DefaultServletEnvironment> servlets
Stores the servlets.
-
filters
protected final Map<String,DefaultFilterEnvironment> filters
Stores the filters.
-
contextAttributeListeners
protected final List<ServletContextAttributeListener> contextAttributeListeners
Stores the servlet context attribute listeners.
-
contextListeners
protected final ArrayList<ServletContextListener> contextListeners
Stores the servlet context listeners.
-
requestListeners
protected final List<ServletRequestListener> requestListeners
Stores the servlet request listeners.
-
objectInstanceManager
protected ObjectInstanceManager objectInstanceManager
Stores the object instance manager.
-
annotationManager
protected AnnotationManager annotationManager
Stores the annotation manager.
-
resourceManager
protected ResourceManager resourceManager
Stores the resource manager.
-
httpSessionManager
protected HttpSessionManager httpSessionManager
Stores the session manager.
-
securityManager
protected SecurityManager securityManager
Stores the security manager.
-
jspManager
protected JspManager jspManager
Stores the JSP manager.
-
loggingManager
protected LoggingManager loggingManager
Stores the logging manager.
-
httpRequestManager
protected HttpRequestManager httpRequestManager
Stores the request manager.
-
mimeTypeManager
protected MimeTypeManager mimeTypeManager
Stores the mime type manager.
-
multiPartManager
protected MultiPartManager multiPartManager
Stores the multi part manager.
-
requestCharacterEncoding
protected String requestCharacterEncoding
Stores the request character encoding.
-
webApplicationRequestMapper
protected WebApplicationRequestMapper webApplicationRequestMapper
Stores the web application request mapper.
-
welcomeFileManager
protected WelcomeFileManager welcomeFileManager
Stores the welcome file manager.
-
-
Method Detail
-
addFilter
public FilterRegistration.Dynamic addFilter(String filterName, String className)
Add the filter.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- the filter name.className
- the class name.- Returns:
- the filter dynamic.
-
addFilter
public FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass)
Add the filter.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- the filter name.filterClass
- the filter class.- Returns:
- the filter dynamic.
- See Also:
ServletContext.addFilter(java.lang.String, java.lang.Class)
-
addFilter
public FilterRegistration.Dynamic addFilter(String filterName, Filter filter)
Add the filter.- Specified by:
addFilter
in interfaceServletContext
- Parameters:
filterName
- the filter name.filter
- the filter.- Returns:
- the filter dynamic registration.
-
addFilterMapping
public Set<String> addFilterMapping(String filterName, String... urlPatterns)
Description copied from interface:WebApplication
Add a mapping for the given filter.- Specified by:
addFilterMapping
in interfaceWebApplication
- 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
public Set<String> addFilterMapping(String filterName, boolean isMatchAfter, String... urlPatterns)
Description copied from interface:WebApplication
Add a mapping for the given filter.- Specified by:
addFilterMapping
in interfaceWebApplication
- 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...)
-
addInitializer
public void addInitializer(String className)
Add a servlet container initializer.- Specified by:
addInitializer
in interfaceWebApplication
- Parameters:
className
- the class name.
-
addInitializer
public void addInitializer(ServletContainerInitializer servletContainerInitializer)
Description copied from interface:WebApplication
Add a servlet container initializer.- Specified by:
addInitializer
in interfaceWebApplication
- Parameters:
servletContainerInitializer
- the servletContainerInitializer instance
-
addJspFile
public ServletRegistration.Dynamic addJspFile(String servletName, String jspFile)
Add a JSP file.- Specified by:
addJspFile
in interfaceServletContext
- Parameters:
servletName
- the name of the servlet.jspFile
- the JSP file.- Returns:
- the dynamic servlet registration.
-
addListener
public void addListener(String className)
Add listener.- Specified by:
addListener
in interfaceServletContext
- Parameters:
className
- the class name.
-
addListener
public void addListener(Class<? extends EventListener> type)
Add the listener.- Specified by:
addListener
in interfaceServletContext
- Parameters:
type
- the type.
-
addListener
public <T extends EventListener> void addListener(T listener)
Add the listener.- Specified by:
addListener
in interfaceServletContext
- Type Parameters:
T
- the type.- Parameters:
listener
- the listener
-
addResource
public void addResource(Resource resource)
Add the resource.- Specified by:
addResource
in interfaceWebApplication
- Parameters:
resource
- the resource.
-
addServlet
public ServletRegistration.Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass)
Add the servlet.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- the servlet name.servletClass
- the class type.- Returns:
- the servlet dynamic.
-
addServlet
public ServletRegistration.Dynamic addServlet(String servletName, String className)
Add the servlet.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- the servlet name.className
- the class name.- Returns:
- the servlet dynamic.
-
addServlet
public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet)
Add the servlet.- Specified by:
addServlet
in interfaceServletContext
- Parameters:
servletName
- the servlet name.servlet
- the servlet.- Returns:
- the servlet dynamic.
-
addServletMapping
public Set<String> addServletMapping(String servletName, String... urlPatterns)
Add the servlet mapping.- Specified by:
addServletMapping
in interfaceWebApplication
- Parameters:
servletName
- the servlet name.urlPatterns
- the URL patterns.- Returns:
- the set of added mappings.
- See Also:
ServletRegistration.addMapping(String...)
-
addErrorPage
public void addErrorPage(int code, String location)
Description copied from interface:WebApplication
Adds an error page to be forwarded to on the given HTTP status code- Specified by:
addErrorPage
in interfaceWebApplication
- Parameters:
code
- the HTTP code for which the error page is to be invokedlocation
- the location of the error page
-
addErrorPage
public void addErrorPage(String exception, String location)
Description copied from interface:WebApplication
Adds an error page to be forwarded to on the given exception- Specified by:
addErrorPage
in interfaceWebApplication
- Parameters:
exception
- the exception for which the error page is to be invokedlocation
- the location of the error page
-
createFilter
public <T extends Filter> T createFilter(Class<T> filterClass) throws ServletException
Create the filter.- Specified by:
createFilter
in interfaceServletContext
- Type Parameters:
T
- the return type.- Parameters:
filterClass
- the filter class.- Returns:
- the filter.
- Throws:
ServletException
- when a Filter error occurs.
-
createListener
public <T extends EventListener> T createListener(Class<T> clazz) throws ServletException
Create the listener.- Specified by:
createListener
in interfaceServletContext
- Type Parameters:
T
- the type.- Parameters:
clazz
- the class of the listener to create.- Returns:
- the listener.
- Throws:
ServletException
- when it fails to create the listener.
-
createServlet
public <T extends Servlet> T createServlet(Class<T> servletClass) throws ServletException
Create the servlet.- Specified by:
createServlet
in interfaceServletContext
- Type Parameters:
T
- the return type.- Parameters:
servletClass
- the servlet class.- Returns:
- the servlet.
- Throws:
ServletException
- when a Servlet error occurs.
-
declareRoles
public void declareRoles(String... roles)
Declare roles.- Specified by:
declareRoles
in interfaceServletContext
- Parameters:
roles
- the roles.
-
destroy
public void destroy()
Destroy the web application.- Specified by:
destroy
in interfaceWebApplication
-
findFilterEnvironments
protected List<DefaultFilterEnvironment> findFilterEnvironments(HttpServletRequest request)
Find the filter environments.- Parameters:
request
- the HTTP servlet request.- Returns:
- the filter environments.
-
getAttribute
public Object getAttribute(String name)
Get the attribute.- Specified by:
getAttribute
in interfaceServletContext
- Parameters:
name
- the attribute name.- Returns:
- the attribute value.
-
getAttributeNames
public Enumeration<String> getAttributeNames()
Get the attribute names.- Specified by:
getAttributeNames
in interfaceServletContext
- Returns:
- the attribute names.
-
getDenyUncoveredHttpMethods
public boolean getDenyUncoveredHttpMethods()
Are we denying uncovered HTTP methods.- Specified by:
getDenyUncoveredHttpMethods
in interfaceWebApplication
- Returns:
- true if we are, false otherwise.
-
getClassLoader
public ClassLoader getClassLoader()
Get the class loader.- Specified by:
getClassLoader
in interfaceServletContext
- Returns:
- the class loader.
-
getContext
public ServletContext getContext(String uripath)
Get the servlet context for the given uripath.- Specified by:
getContext
in interfaceServletContext
- Parameters:
uripath
- the uripath.- Returns:
- the servlet context.
-
getContextPath
public String getContextPath()
Get the context path.- Specified by:
getContextPath
in interfaceServletContext
- Returns:
- the context path.
-
getDefaultSessionTrackingModes
public Set<SessionTrackingMode> getDefaultSessionTrackingModes()
Description copied from interface:ServletContext
Get the default session tracking modes.- Specified by:
getDefaultSessionTrackingModes
in interfaceServletContext
- Returns:
- the default session tracking modes.
- See Also:
ServletContext.getDefaultSessionTrackingModes()
-
getDefaultServlet
public Servlet getDefaultServlet()
Description copied from interface:WebApplication
Get the default Servlet.- Specified by:
getDefaultServlet
in interfaceWebApplication
- Returns:
- the default Servlet.
- See Also:
WebApplication.getDefaultServlet()
-
getObjectInstanceManager
public ObjectInstanceManager getObjectInstanceManager()
Get the DependencyInjectionManager.- Specified by:
getObjectInstanceManager
in interfaceWebApplication
- Returns:
- the DependencyInjectionManager.
-
getEffectiveMajorVersion
public int getEffectiveMajorVersion()
Get the effective major version.- Specified by:
getEffectiveMajorVersion
in interfaceServletContext
- Returns:
- the effective major version.
-
getEffectiveMinorVersion
public int getEffectiveMinorVersion()
Get the effective minor version.- Specified by:
getEffectiveMinorVersion
in interfaceServletContext
- Returns:
- the effective minor version.
-
getMultiPartManager
public MultiPartManager getMultiPartManager()
Get the multi part manager.- Specified by:
getMultiPartManager
in interfaceWebApplication
- Returns:
- the multi part manager.
-
getEffectiveSessionTrackingModes
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes()
Get the effective tracking modes.- Specified by:
getEffectiveSessionTrackingModes
in interfaceServletContext
- Returns:
- the effective tracking modes.
-
getFilterRegistration
public FilterRegistration getFilterRegistration(String filterName)
Get the filter registration.- Specified by:
getFilterRegistration
in interfaceServletContext
- Parameters:
filterName
- the filter name.- Returns:
- the filter registration, or null if not found.
-
getFilterRegistrations
public Map<String,? extends FilterRegistration> getFilterRegistrations()
Get the filter registrations.- Specified by:
getFilterRegistrations
in interfaceServletContext
- Returns:
- the filter registrations.
-
getInitParameter
public String getInitParameter(String name)
Get the init parameter.- Specified by:
getInitParameter
in interfaceServletContext
- Parameters:
name
- the init parameter name.- Returns:
- the init parameter value.
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
Get the init parameter names.- Specified by:
getInitParameterNames
in interfaceServletContext
- Returns:
- the enumeration.
-
getJspConfigDescriptor
public JspConfigDescriptor getJspConfigDescriptor()
Get the JSP config descriptor.- Specified by:
getJspConfigDescriptor
in interfaceServletContext
- Returns:
- the JSP config descriptor.
-
getMajorVersion
public int getMajorVersion()
Get the major version.- Specified by:
getMajorVersion
in interfaceServletContext
- Returns:
- the major version.
-
getMappings
public Collection<String> getMappings(String servletName)
Get the servlet mappings for the given servlet.- Specified by:
getMappings
in interfaceWebApplication
- Parameters:
servletName
- the name of the servlet.- Returns:
- the servlet mappings.
- See Also:
ServletRegistration.getMappings()
-
getMimeType
public String getMimeType(String filename)
Get the mime type.- Specified by:
getMimeType
in interfaceServletContext
- Parameters:
filename
- the filename.- Returns:
- the mime type.
-
getMimeTypeManager
public MimeTypeManager getMimeTypeManager()
Get the mime type manager.- Specified by:
getMimeTypeManager
in interfaceWebApplication
- Returns:
- the mime type manager.
-
getMinorVersion
public int getMinorVersion()
Get the minor version.- Specified by:
getMinorVersion
in interfaceServletContext
- Returns:
- the minor version.
-
getNamedDispatcher
public RequestDispatcher getNamedDispatcher(String name)
Get the name request dispatcher.- Specified by:
getNamedDispatcher
in interfaceServletContext
- Parameters:
name
- the name.- Returns:
- the request dispatcher.
-
getNamedDispatcher
protected RequestDispatcher getNamedDispatcher(String name, String path)
Get the name request dispatcher.- Parameters:
name
- the name.path
- the path.- Returns:
- the request dispatcher.
-
getRealPath
public String getRealPath(String path)
Get the real path.- Specified by:
getRealPath
in interfaceServletContext
- Parameters:
path
- the path- Returns:
- the real path.
-
getRequest
public ServletRequest getRequest(ServletResponse response)
Get the request associated with the response.- Specified by:
getRequest
in interfaceWebApplication
- Parameters:
response
- the response.- Returns:
- the request.
-
getRequestCharacterEncoding
public String getRequestCharacterEncoding()
Get the default request character encoding.- Specified by:
getRequestCharacterEncoding
in interfaceServletContext
- Returns:
- the default request character encoding.
-
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
Get the request dispatcher.- Specified by:
getRequestDispatcher
in interfaceServletContext
- Parameters:
path
- the path.- Returns:
- the request dispatcher.
-
getResponseCharacterEncoding
public String getResponseCharacterEncoding()
Get the default response character encoding.- Specified by:
getResponseCharacterEncoding
in interfaceServletContext
- Returns:
- the default response character encoding.
-
getResource
public URL getResource(String location) throws MalformedURLException
Get the resource.- Specified by:
getResource
in interfaceServletContext
- Parameters:
location
- the location.- Returns:
- the URL.
- Throws:
MalformedURLException
- when the URL is malformed.
-
getResourceAsStream
public InputStream getResourceAsStream(String location)
Get the resource as a stream.- Specified by:
getResourceAsStream
in interfaceServletContext
- Parameters:
location
- the resource location- Returns:
- the input stream, or null if not found.
-
getResourcePaths
public Set<String> getResourcePaths(String path)
Get the resource paths.- Specified by:
getResourcePaths
in interfaceServletContext
- Parameters:
path
- the path.- Returns:
- the resource paths.
-
getResponse
public ServletResponse getResponse(ServletRequest request)
Get the response.- Specified by:
getResponse
in interfaceWebApplication
- Parameters:
request
- the request.- Returns:
- the response.
-
getSecurityManager
public SecurityManager getSecurityManager()
Get the security manager.- Specified by:
getSecurityManager
in interfaceWebApplication
- Returns:
- the security manager.
-
getAnnotationManager
public AnnotationManager getAnnotationManager()
Description copied from interface:WebApplication
Gets the annotation manager.- Specified by:
getAnnotationManager
in interfaceWebApplication
- Returns:
- the annotation manager.
-
setAnnotationManager
public void setAnnotationManager(AnnotationManager annotationManager)
Description copied from interface:WebApplication
Sets the annotation manager.- Specified by:
setAnnotationManager
in interfaceWebApplication
- Parameters:
annotationManager
- the annotation manager
-
getServerInfo
public String getServerInfo()
Get the server info.- Specified by:
getServerInfo
in interfaceServletContext
- Returns:
- the server info.
-
getServlet
public Servlet getServlet(String name) throws ServletException
Deprecated.Get the servlet.- Specified by:
getServlet
in interfaceServletContext
- Parameters:
name
- the name of the servlet.- Returns:
- null
- Throws:
ServletException
- when a Servlet error occurs.
-
getServletContextName
public String getServletContextName()
Get the servlet context name (aka display-name).- Specified by:
getServletContextName
in interfaceServletContext
- Returns:
- the servlet context name.
-
getServletNames
public Enumeration<String> getServletNames()
Deprecated.Get the servlet names.- Specified by:
getServletNames
in interfaceServletContext
- Returns:
- the servlet names.
-
getServletRegistration
public ServletRegistration getServletRegistration(String servletName)
Get the servlet registration.- Specified by:
getServletRegistration
in interfaceServletContext
- Parameters:
servletName
- the servlet name.- Returns:
- the servlet registration, or null if not found.
-
getServletRegistrations
public Map<String,? extends ServletRegistration> getServletRegistrations()
Get the servlet registrations.- Specified by:
getServletRegistrations
in interfaceServletContext
- Returns:
- the servlet registrations.
-
getServlets
public Enumeration<Servlet> getServlets()
Deprecated.Get the servlets.- Specified by:
getServlets
in interfaceServletContext
- Returns:
- the servlets (empty enumeration).
-
getSessionCookieConfig
public SessionCookieConfig getSessionCookieConfig()
Get the session cookie config.- Specified by:
getSessionCookieConfig
in interfaceServletContext
- Returns:
- the session cookie config.
-
getSessionTimeout
public int getSessionTimeout()
Get the default session timeout.- Specified by:
getSessionTimeout
in interfaceServletContext
- Returns:
- the default session timeout.
-
getHttpSessionManager
public HttpSessionManager getHttpSessionManager()
Get the session manager.- Specified by:
getHttpSessionManager
in interfaceWebApplication
- Returns:
- the session manager.
-
getVirtualServerName
public String getVirtualServerName()
Get the virtual server name.- Specified by:
getVirtualServerName
in interfaceServletContext
- Returns:
- the virtual server name.
-
getWelcomeFileManager
public WelcomeFileManager getWelcomeFileManager()
Get the welcome file manager.- Specified by:
getWelcomeFileManager
in interfaceWebApplication
- Returns:
- the welcome file manager.
-
initialize
public void initialize()
Initialize the web application.- Specified by:
initialize
in interfaceWebApplication
-
initializeFinish
public void initializeFinish()
Finish the initialization.- Specified by:
initializeFinish
in interfaceWebApplication
-
initializeFilters
public void initializeFilters()
Initialize the filters.- Specified by:
initializeFilters
in interfaceWebApplication
-
initializeInitializers
public void initializeInitializers()
Initialize the servlet container initializers.- Specified by:
initializeInitializers
in interfaceWebApplication
-
initializeServlets
public void initializeServlets()
Initialize the servlets.- Specified by:
initializeServlets
in interfaceWebApplication
-
isDistributable
public boolean isDistributable()
Is the web application distributable.- Specified by:
isDistributable
in interfaceWebApplication
- Returns:
- true if it is, false otherwise.
-
linkRequestAndResponse
public void linkRequestAndResponse(ServletRequest request, ServletResponse response)
Link the request and response.- Specified by:
linkRequestAndResponse
in interfaceWebApplication
- Parameters:
request
- the request.response
- the response.
-
log
public void log(Exception exception, String message)
Deprecated.Log a message.- Specified by:
log
in interfaceServletContext
- Parameters:
exception
- the exception.message
- the message.
-
log
public void log(String message, Throwable throwable)
Log a message.- Specified by:
log
in interfaceServletContext
- Parameters:
message
- the message.throwable
- the throwable.
-
log
public void log(String message)
Log a message.- Specified by:
log
in interfaceServletContext
- Parameters:
message
- the message.
-
removeAttribute
public void removeAttribute(String name)
Remove the attribute with the given name.- Specified by:
removeAttribute
in interfaceServletContext
- Parameters:
name
- the name.
-
service
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
Service the request using this web application.- Specified by:
service
in interfaceWebApplication
- Parameters:
request
- the servlet request.response
- the servlet response.- Throws:
IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.
-
setAttribute
public void setAttribute(String name, Object value)
Set the attribute.- Specified by:
setAttribute
in interfaceServletContext
- Parameters:
name
- the attribute name.value
- the attribute value.
-
setClassLoader
public void setClassLoader(ClassLoader classLoader)
Set the class-loader.- Specified by:
setClassLoader
in interfaceWebApplication
- Parameters:
classLoader
- the class loader.
-
setContextPath
public void setContextPath(String contextPath)
Set the context path.- Specified by:
setContextPath
in interfaceWebApplication
- Parameters:
contextPath
- the context path.
-
setDefaultServlet
public void setDefaultServlet(Servlet defaultServlet)
Description copied from interface:WebApplication
Set the default servlet.- Specified by:
setDefaultServlet
in interfaceWebApplication
- Parameters:
defaultServlet
- the default servlet.- See Also:
WebApplication.setDefaultServlet(javax.servlet.Servlet)
-
setDenyUncoveredHttpMethods
public void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods)
Set if we are denying uncovered HTTP methods.- Specified by:
setDenyUncoveredHttpMethods
in interfaceWebApplication
- Parameters:
denyUncoveredHttpMethods
- the boolean value.
-
setDistributable
public void setDistributable(boolean distributable)
Set if the web application is distributable.- Specified by:
setDistributable
in interfaceWebApplication
- Parameters:
distributable
- the boolean value.
-
setHttpSessionManager
public void setHttpSessionManager(HttpSessionManager httpSessionManager)
Set the HTTP session manager.- Specified by:
setHttpSessionManager
in interfaceWebApplication
- Parameters:
httpSessionManager
- the HTTP session manager.
-
getHttpRequestManager
public HttpRequestManager getHttpRequestManager()
Description copied from interface:WebApplication
Get the HttpRequestManager.- Specified by:
getHttpRequestManager
in interfaceWebApplication
- Returns:
- the HttpRequestManager.
-
setHttpRequestManager
public void setHttpRequestManager(HttpRequestManager httpRequestManager)
Description copied from interface:WebApplication
Set the HTTP request manager.- Specified by:
setHttpRequestManager
in interfaceWebApplication
- Parameters:
httpRequestManager
- the HTTP request manager.
-
setInitParameter
public boolean setInitParameter(String name, String value)
Set the init parameter.- Specified by:
setInitParameter
in interfaceServletContext
- Parameters:
name
- the name.value
- the value.- Returns:
- true if it could be set, false otherwise.
-
setJspManager
public void setJspManager(JspManager jspManager)
Set the JSP manager.- Specified by:
setJspManager
in interfaceWebApplication
- Parameters:
jspManager
- the JSP manager.
-
setLoggingManager
public void setLoggingManager(LoggingManager loggingManager)
Set the logging manager.- Specified by:
setLoggingManager
in interfaceWebApplication
- Parameters:
loggingManager
- the logging manager.
-
setMimeTypeManager
public void setMimeTypeManager(MimeTypeManager mimeTypeManager)
Set the mimeType manager.- Specified by:
setMimeTypeManager
in interfaceWebApplication
- Parameters:
mimeTypeManager
- the mimeType manager.
-
setMultiPartManager
public void setMultiPartManager(MultiPartManager multiPartManager)
Set the multi part manager.- Specified by:
setMultiPartManager
in interfaceWebApplication
- Parameters:
multiPartManager
- the multi part manager.
-
setObjectInstanceManager
public void setObjectInstanceManager(ObjectInstanceManager objectInstanceManager)
Set the object instance manager.- Specified by:
setObjectInstanceManager
in interfaceWebApplication
- Parameters:
objectInstanceManager
- the object instance manager.
-
setRequestCharacterEncoding
public void setRequestCharacterEncoding(String requestCharacterEncoding)
Set the default request character encoding.- Specified by:
setRequestCharacterEncoding
in interfaceServletContext
- Parameters:
requestCharacterEncoding
- the default request character encoding.
-
setResourceManager
public void setResourceManager(ResourceManager resourceManager)
Set the resource manager.- Specified by:
setResourceManager
in interfaceWebApplication
- Parameters:
resourceManager
- the resource manager.
-
setResponseCharacterEncoding
public void setResponseCharacterEncoding(String responseCharacterEncoding)
Set the default response character encoding.- Specified by:
setResponseCharacterEncoding
in interfaceServletContext
- Parameters:
responseCharacterEncoding
- the default response character encoding.
-
setSecurityManager
public void setSecurityManager(SecurityManager securityManager)
Set the security manager.- Specified by:
setSecurityManager
in interfaceWebApplication
- Parameters:
securityManager
- the security manager.
-
setServletContextName
public void setServletContextName(String servletContextName)
Set the servlet context name.- Specified by:
setServletContextName
in interfaceWebApplication
- Parameters:
servletContextName
- the servlet context name.
-
setSessionTrackingModes
public void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes)
Set the session tracking modes.- Specified by:
setSessionTrackingModes
in interfaceServletContext
- Parameters:
sessionTrackingModes
- the session tracking modes.
-
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
Set the default session timeout.- Specified by:
setSessionTimeout
in interfaceServletContext
- Parameters:
sessionTimeout
- the default session timeout.
-
setVirtualServerName
public void setVirtualServerName(String virtualServerName)
Set the virtual server name.- Parameters:
virtualServerName
- the virtual server name.
-
setWebApplicationRequestMapper
public void setWebApplicationRequestMapper(WebApplicationRequestMapper webApplicationRequestMapper)
Set the web application request mapper.- Specified by:
setWebApplicationRequestMapper
in interfaceWebApplication
- Parameters:
webApplicationRequestMapper
- the web application request mapper.
-
setWelcomeFileManager
public void setWelcomeFileManager(WelcomeFileManager welcomeFileManager)
Set the welcome file manager.- Specified by:
setWelcomeFileManager
in interfaceWebApplication
- Parameters:
welcomeFileManager
- the welcome file manager.
-
start
public void start()
Start servicing.- Specified by:
start
in interfaceWebApplication
-
stop
public void stop()
Stop servicing.- Specified by:
stop
in interfaceWebApplication
-
unlinkRequestAndResponse
public void unlinkRequestAndResponse(ServletRequest request, ServletResponse response)
Unlink the request and response.- Specified by:
unlinkRequestAndResponse
in interfaceWebApplication
- Parameters:
request
- the request.response
- the response.
-
verifyState
protected void verifyState(int desiredStatus, String message)
Verify the web application state.- Parameters:
desiredStatus
- the desired status.message
- the message.
-
getAsyncManager
public AsyncManager getAsyncManager()
Get the async manager.- Specified by:
getAsyncManager
in interfaceWebApplication
- Returns:
- the async manager.
-
-