Package cloud.piranha.webapp.impl
Class DefaultServletEnvironment
- java.lang.Object
-
- cloud.piranha.webapp.impl.DefaultServletEnvironment
-
- All Implemented Interfaces:
Registration
,Registration.Dynamic
,ServletConfig
,ServletRegistration
,ServletRegistration.Dynamic
public class DefaultServletEnvironment extends Object implements ServletRegistration.Dynamic, ServletConfig
The default ServletEnvironment.- Author:
- Manfred Riem ([email protected])
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.servlet.Registration
Registration.Dynamic
-
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 String
className
Stores the class name.protected Map<String,String>
initParameters
Stores the init parameters.protected int
loadOnStartup
Stores the load on startup value.protected MultipartConfigElement
multipartConfig
Stores the multi-part config.protected String
runAsRole
Stores the run-as-role.protected Servlet
servlet
Stores the servlet.protected Class
servletClass
Stores the servlet class.protected String
servletName
Stores the servlet name.protected int
status
Stores the status.static int
UNAVAILABLE
Defines the UNAVAILABLE constant.protected WebApplication
webApp
Stores the web application.
-
Constructor Summary
Constructors Constructor Description DefaultServletEnvironment(DefaultWebApplication webApp, String servletName)
Constructor.DefaultServletEnvironment(DefaultWebApplication webApp, String servletName, Servlet servlet)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
addMapping(String... urlPatterns)
Add a mapping for the given servlet.String
getClassName()
Get the class name.String
getInitParameter(String name)
Get the init parameter.Enumeration<String>
getInitParameterNames()
Get the init parameter names.Map<String,String>
getInitParameters()
Get the init parameters.int
getLoadOnStartup()
Get the load on startup.Collection<String>
getMappings()
Get the mappings.MultipartConfigElement
getMultipartConfig()
Get the multi-part config.String
getName()
Get the servlet name.String
getRunAsRole()
Get the "Run as Role".Servlet
getServlet()
Get the servlet.Class
getServletClass()
Get the servlet class.ServletContext
getServletContext()
Get the servlet context.String
getServletName()
Get the servlet name.WebApplication
getWebApplication()
Get the web application.boolean
isAsyncSupported()
Is async supported.void
setAsyncSupported(boolean asyncSupported)
Set the async supported flag.void
setClassName(String className)
Set the class name.boolean
setInitParameter(String name, String value)
Set the init parameter.Set<String>
setInitParameters(Map<String,String> initParameters)
Set the init parameters.void
setLoadOnStartup(int loadOnStartup)
Set the load on startup.void
setMultipartConfig(MultipartConfigElement multipartConfig)
Set the multipart config.void
setRunAsRole(String runAsRole)
Set the run as role.void
setServlet(Servlet servlet)
Set the servlet.Set<String>
setServletSecurity(ServletSecurityElement servletSecurityElement)
Set the servlet security element.void
setStatus(int status)
Set the status.
-
-
-
Field Detail
-
UNAVAILABLE
public static final int UNAVAILABLE
Defines the UNAVAILABLE constant.- See Also:
- Constant Field Values
-
asyncSupported
protected boolean asyncSupported
Stores the async supported flag.
-
className
protected String className
Stores the class name.
-
loadOnStartup
protected int loadOnStartup
Stores the load on startup value.
-
multipartConfig
protected MultipartConfigElement multipartConfig
Stores the multi-part config.
-
runAsRole
protected String runAsRole
Stores the run-as-role.
-
servlet
protected Servlet servlet
Stores the servlet.
-
servletClass
protected Class servletClass
Stores the servlet class.
-
servletName
protected final String servletName
Stores the servlet name.
-
status
protected int status
Stores the status.
-
webApp
protected final WebApplication webApp
Stores the web application.
-
-
Constructor Detail
-
DefaultServletEnvironment
public DefaultServletEnvironment(DefaultWebApplication webApp, String servletName)
Constructor.- Parameters:
webApp
- the web application.servletName
- the servlet name.
-
DefaultServletEnvironment
public DefaultServletEnvironment(DefaultWebApplication webApp, String servletName, Servlet servlet)
Constructor.- Parameters:
webApp
- the web application.servletName
- the servlet name.servlet
- the servlet.
-
-
Method Detail
-
addMapping
public Set<String> addMapping(String... urlPatterns)
Add a mapping for the given servlet.- Specified by:
addMapping
in interfaceServletRegistration
- Parameters:
urlPatterns
- the url patterns.- Returns:
- a set of which mappings where set.
-
getClassName
public String getClassName()
Get the class name.- Specified by:
getClassName
in interfaceRegistration
- Returns:
- the class name.
-
getInitParameter
public String getInitParameter(String name)
Get the init parameter.- Specified by:
getInitParameter
in interfaceRegistration
- Specified by:
getInitParameter
in interfaceServletConfig
- Parameters:
name
- the parameter name.- Returns:
- the value.
-
getInitParameterNames
public Enumeration<String> getInitParameterNames()
Get the init parameter names.- Specified by:
getInitParameterNames
in interfaceServletConfig
- Returns:
- the init parameter names.
-
getInitParameters
public Map<String,String> getInitParameters()
Get the init parameters.- Specified by:
getInitParameters
in interfaceRegistration
- Returns:
- the init parameters.
-
getLoadOnStartup
public int getLoadOnStartup()
Get the load on startup.- Returns:
- the load on startup.
-
getMappings
public Collection<String> getMappings()
Get the mappings.- Specified by:
getMappings
in interfaceServletRegistration
- Returns:
- the mappings.
-
getMultipartConfig
public MultipartConfigElement getMultipartConfig()
Get the multi-part config.- Returns:
- the multi-part config.
-
getName
public String getName()
Get the servlet name.- Specified by:
getName
in interfaceRegistration
- Returns:
- the servlet name.
-
getRunAsRole
public String getRunAsRole()
Get the "Run as Role".- Specified by:
getRunAsRole
in interfaceServletRegistration
- Returns:
- the role.
-
getServlet
public Servlet getServlet()
Get the servlet.- Returns:
- the servlet.
-
getServletContext
public ServletContext getServletContext()
Get the servlet context.- Specified by:
getServletContext
in interfaceServletConfig
- Returns:
- the servlet context.
-
getServletClass
public Class getServletClass()
Get the servlet class.- Returns:
- the servlet class.
-
getServletName
public String getServletName()
Get the servlet name.- Specified by:
getServletName
in interfaceServletConfig
- Returns:
- the servlet name.
-
getWebApplication
public WebApplication getWebApplication()
Get the web application.- Returns:
- the web application.
-
isAsyncSupported
public boolean isAsyncSupported()
Is async supported.- Returns:
- true if it is, false otherwise.
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
Set the async supported flag.- Specified by:
setAsyncSupported
in interfaceRegistration.Dynamic
- Parameters:
asyncSupported
- the async supported flag.
-
setClassName
public void setClassName(String className)
Set the class name.- Parameters:
className
- the class name.
-
setInitParameter
public boolean setInitParameter(String name, String value)
Set the init parameter.- Specified by:
setInitParameter
in interfaceRegistration
- Parameters:
name
- the parameter name.value
- the parameter value.- Returns:
- if the init parameter was set.
-
setInitParameters
public Set<String> setInitParameters(Map<String,String> initParameters)
Set the init parameters.- Specified by:
setInitParameters
in interfaceRegistration
- Parameters:
initParameters
- the init parameters.- Returns:
- the set of set init parameters that could not be set.
-
setLoadOnStartup
public void setLoadOnStartup(int loadOnStartup)
Set the load on startup.- Specified by:
setLoadOnStartup
in interfaceServletRegistration.Dynamic
- Parameters:
loadOnStartup
- the load on startup.
-
setMultipartConfig
public void setMultipartConfig(MultipartConfigElement multipartConfig)
Set the multipart config.- Specified by:
setMultipartConfig
in interfaceServletRegistration.Dynamic
- Parameters:
multipartConfig
- the multipart config.
-
setRunAsRole
public void setRunAsRole(String runAsRole)
Set the run as role.- Specified by:
setRunAsRole
in interfaceServletRegistration.Dynamic
- Parameters:
runAsRole
- the run as role.
-
setServlet
public void setServlet(Servlet servlet)
Set the servlet.- Parameters:
servlet
- the servlet.
-
setServletSecurity
public Set<String> setServletSecurity(ServletSecurityElement servletSecurityElement)
Set the servlet security element.- Specified by:
setServletSecurity
in interfaceServletRegistration.Dynamic
- Parameters:
servletSecurityElement
- the servlet security element.- Returns:
- the servlet security element.
-
setStatus
public void setStatus(int status)
Set the status.- Parameters:
status
- the status.
-
-