java.lang.Object
cloud.piranha.webapp.impl.DefaultServletEnvironment
- All Implemented Interfaces:
ServletEnvironment
,Registration
,Registration.Dynamic
,ServletConfig
,ServletRegistration
,ServletRegistration.Dynamic
public class DefaultServletEnvironment extends java.lang.Object implements ServletEnvironment
The default ServletEnvironment.
- Author:
- Manfred Riem ([email protected])
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.servlet.ServletRegistration
ServletRegistration.Dynamic
-
Field Summary
Fields Modifier and Type Field Description protected boolean
asyncSupported
Stores the async supported flag.protected java.lang.String
className
Stores the class name.protected java.util.Map<java.lang.String,java.lang.String>
initParameters
Stores the init parameters.protected int
loadOnStartup
Stores the load on startup value.protected MultipartConfigElement
multipartConfig
Stores the multi-part config.protected java.lang.String
runAsRole
Stores the run-as-role.protected Servlet
servlet
Stores the servlet.protected java.lang.Class<? extends Servlet>
servletClass
Stores the servlet class.protected java.lang.String
servletName
Stores the servlet name.protected int
status
Stores the status.protected java.lang.Throwable
unavailableException
Stores the unavailableException.protected WebApplication
webApp
Stores the web application. -
Constructor Summary
Constructors Constructor Description DefaultServletEnvironment(DefaultWebApplication webApp, java.lang.String servletName)
Constructor.DefaultServletEnvironment(DefaultWebApplication webApp, java.lang.String servletName, Servlet servlet)
Constructor. -
Method Summary
Modifier and Type Method Description java.util.Set<java.lang.String>
addMapping(java.lang.String... urlPatterns)
Add a mapping.java.lang.String
getClassName()
Get the class name.java.lang.String
getInitParameter(java.lang.String name)
Get the init parameter.java.util.Enumeration<java.lang.String>
getInitParameterNames()
Get the init parameter names.java.util.Map<java.lang.String,java.lang.String>
getInitParameters()
Get the init parameters.int
getLoadOnStartup()
Get the load on startup.java.util.Collection<java.lang.String>
getMappings()
Get the mappings.MultipartConfigElement
getMultipartConfig()
Get the multi-part config.java.lang.String
getName()
Get the name.java.lang.String
getRunAsRole()
Get the run as role.Servlet
getServlet()
Get the servlet.java.lang.Class<? extends Servlet>
getServletClass()
Get the servlet class.ServletContext
getServletContext()
Get the servlet context.java.lang.String
getServletName()
Get the servlet name.int
getStatus()
Get the status.java.lang.Throwable
getUnavailableException()
The exception that caused this servlet to become unavailableWebApplication
getWebApplication()
Get the web application.boolean
isAsyncSupported()
Is async supported.void
setAsyncSupported(boolean asyncSupported)
Set async supported.void
setClassName(java.lang.String className)
Set the class name.boolean
setInitParameter(java.lang.String name, java.lang.String value)
Set the init parameter.java.util.Set<java.lang.String>
setInitParameters(java.util.Map<java.lang.String,java.lang.String> initParameters)
Set the init parameters.void
setLoadOnStartup(int loadOnStartup)
Set the load on startup.void
setMultipartConfig(MultipartConfigElement multipartConfig)
Set the multipart config element.void
setRunAsRole(java.lang.String runAsRole)
Set the run as role.void
setServlet(Servlet servlet)
Set the servlet.java.util.Set<java.lang.String>
setServletSecurity(ServletSecurityElement servletSecurityElement)
Set the servlet security.void
setStatus(int status)
Set the status.void
setUnavailableException(java.lang.Throwable unavailableException)
Sets the exception that caused this servlet to become unavailable
-
Field Details
-
asyncSupported
protected boolean asyncSupportedStores the async supported flag. -
className
protected java.lang.String classNameStores the class name. -
initParameters
protected final java.util.Map<java.lang.String,java.lang.String> initParametersStores the init parameters. -
loadOnStartup
protected int loadOnStartupStores the load on startup value. -
multipartConfig
Stores the multi-part config. -
runAsRole
protected java.lang.String runAsRoleStores the run-as-role. -
servlet
Stores the servlet. -
servletClass
Stores the servlet class. -
servletName
protected final java.lang.String servletNameStores the servlet name. -
status
protected int statusStores the status. -
unavailableException
protected java.lang.Throwable unavailableExceptionStores the unavailableException. -
webApp
Stores the web application.
-
-
Constructor Details
-
DefaultServletEnvironment
Constructor.- Parameters:
webApp
- the web application.servletName
- the servlet name.
-
DefaultServletEnvironment
public DefaultServletEnvironment(DefaultWebApplication webApp, java.lang.String servletName, Servlet servlet)Constructor.- Parameters:
webApp
- the web application.servletName
- the servlet name.servlet
- the servlet.
-
-
Method Details
-
addMapping
public java.util.Set<java.lang.String> addMapping(java.lang.String... urlPatterns)Description copied from interface:ServletRegistration
Add a mapping.- Specified by:
addMapping
in interfaceServletRegistration
- Parameters:
urlPatterns
- the URL patterns.- Returns:
- the patterns that were already mapped before.
-
getClassName
public java.lang.String getClassName()Description copied from interface:Registration
Get the class name.- Specified by:
getClassName
in interfaceRegistration
- Returns:
- the class name.
-
getInitParameter
public java.lang.String getInitParameter(java.lang.String name)Description copied from interface:Registration
Get the init parameter.- Specified by:
getInitParameter
in interfaceRegistration
- Specified by:
getInitParameter
in interfaceServletConfig
- Parameters:
name
- the name.- Returns:
- the value, or null if not found.
-
getInitParameterNames
public java.util.Enumeration<java.lang.String> getInitParameterNames()Description copied from interface:ServletConfig
Get the init parameter names.- Specified by:
getInitParameterNames
in interfaceServletConfig
- Returns:
- the init parameter names.
-
getInitParameters
public java.util.Map<java.lang.String,java.lang.String> getInitParameters()Description copied from interface:Registration
Get the init parameters.- Specified by:
getInitParameters
in interfaceRegistration
- Returns:
- the init parameters.
-
getLoadOnStartup
public int getLoadOnStartup()Description copied from interface:ServletEnvironment
Get the load on startup.- Specified by:
getLoadOnStartup
in interfaceServletEnvironment
- Returns:
- the load on startup.
-
getMappings
public java.util.Collection<java.lang.String> getMappings()Description copied from interface:ServletRegistration
Get the mappings.- Specified by:
getMappings
in interfaceServletRegistration
- Returns:
- the mappings.
-
getMultipartConfig
Description copied from interface:ServletEnvironment
Get the multi-part config.- Specified by:
getMultipartConfig
in interfaceServletEnvironment
- Returns:
- the multi-part config.
-
getName
public java.lang.String getName()Description copied from interface:Registration
Get the name.- Specified by:
getName
in interfaceRegistration
- Returns:
- the name.
-
getRunAsRole
public java.lang.String getRunAsRole()Description copied from interface:ServletRegistration
Get the run as role.- Specified by:
getRunAsRole
in interfaceServletRegistration
- Returns:
- the run as role.
-
getServlet
Description copied from interface:ServletEnvironment
Get the servlet.- Specified by:
getServlet
in interfaceServletEnvironment
- Returns:
- the servlet.
-
getServletContext
Description copied from interface:ServletConfig
Get the servlet context.- Specified by:
getServletContext
in interfaceServletConfig
- Returns:
- the servlet context.
-
getServletClass
Description copied from interface:ServletEnvironment
Get the servlet class.- Specified by:
getServletClass
in interfaceServletEnvironment
- Returns:
- the servlet class.
-
getServletName
public java.lang.String getServletName()Description copied from interface:ServletConfig
Get the servlet name.- Specified by:
getServletName
in interfaceServletConfig
- Returns:
- the servlet name.
-
getStatus
public int getStatus()Description copied from interface:ServletEnvironment
Get the status.- Specified by:
getStatus
in interfaceServletEnvironment
- Returns:
- the status.
-
getWebApplication
Description copied from interface:ServletEnvironment
Get the web application.- Specified by:
getWebApplication
in interfaceServletEnvironment
- Returns:
- the web application.
-
isAsyncSupported
public boolean isAsyncSupported()Description copied from interface:ServletEnvironment
Is async supported.- Specified by:
isAsyncSupported
in interfaceServletEnvironment
- Returns:
- true if it is, false otherwise.
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)Description copied from interface:Registration.Dynamic
Set async supported.- Specified by:
setAsyncSupported
in interfaceRegistration.Dynamic
- Parameters:
asyncSupported
- the async supported flag.
-
setClassName
public void setClassName(java.lang.String className)Description copied from interface:ServletEnvironment
Set the class name.- Specified by:
setClassName
in interfaceServletEnvironment
- Parameters:
className
- the class name.
-
setInitParameter
public boolean setInitParameter(java.lang.String name, java.lang.String value)Description copied from interface:Registration
Set the init parameter.- Specified by:
setInitParameter
in interfaceRegistration
- Parameters:
name
- the name.value
- the value.- Returns:
- true if it was set, false otherwise.
-
setInitParameters
public java.util.Set<java.lang.String> setInitParameters(java.util.Map<java.lang.String,java.lang.String> initParameters)Description copied from interface:Registration
Set the init parameters.- Specified by:
setInitParameters
in interfaceRegistration
- Parameters:
initParameters
- the init parameters.- Returns:
- the init parameters that could NOT be set.
-
setLoadOnStartup
public void setLoadOnStartup(int loadOnStartup)Description copied from interface:ServletRegistration.Dynamic
Set the load on startup.- Specified by:
setLoadOnStartup
in interfaceServletRegistration.Dynamic
- Parameters:
loadOnStartup
- the load on startup.
-
setMultipartConfig
Description copied from interface:ServletRegistration.Dynamic
Set the multipart config element.- Specified by:
setMultipartConfig
in interfaceServletRegistration.Dynamic
- Parameters:
multipartConfig
- the multipart config element.
-
setRunAsRole
public void setRunAsRole(java.lang.String runAsRole)Description copied from interface:ServletRegistration.Dynamic
Set the run as role.- Specified by:
setRunAsRole
in interfaceServletRegistration.Dynamic
- Parameters:
runAsRole
- the role.
-
setServlet
Description copied from interface:ServletEnvironment
Set the servlet.- Specified by:
setServlet
in interfaceServletEnvironment
- Parameters:
servlet
- the servlet.
-
setServletSecurity
public java.util.Set<java.lang.String> setServletSecurity(ServletSecurityElement servletSecurityElement)Description copied from interface:ServletRegistration.Dynamic
Set the servlet security.- Specified by:
setServletSecurity
in interfaceServletRegistration.Dynamic
- Parameters:
servletSecurityElement
- the constraint.- Returns:
- the already mapped URL patterns.
-
setStatus
public void setStatus(int status)Description copied from interface:ServletEnvironment
Set the status.- Specified by:
setStatus
in interfaceServletEnvironment
- Parameters:
status
- the status.
-
getUnavailableException
public java.lang.Throwable getUnavailableException()Description copied from interface:ServletEnvironment
The exception that caused this servlet to become unavailable- Specified by:
getUnavailableException
in interfaceServletEnvironment
- Returns:
- the exception.
-
setUnavailableException
public void setUnavailableException(java.lang.Throwable unavailableException)Description copied from interface:ServletEnvironment
Sets the exception that caused this servlet to become unavailable- Specified by:
setUnavailableException
in interfaceServletEnvironment
-