public class ServletRegistrationImpl extends Object implements ServletRegistration, ServletRegistration.Dynamic
ServletRegistration.Dynamic
Constructor and Description |
---|
ServletRegistrationImpl(ServletInfo servletInfo,
ManagedServlet managedServlet,
Deployment deployment) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
addMapping(String... urlPatterns)
Adds a servlet mapping with the given URL patterns for the Servlet
represented by this ServletRegistration.
|
String |
getClassName()
Gets the fully qualified class name of the Servlet or Filter that
is represented by this Registration.
|
String |
getInitParameter(String name)
Gets the value of the initialization parameter with the given name
that will be used to initialize the Servlet or Filter represented
by this Registration object.
|
Map<String,String> |
getInitParameters()
Gets an immutable (and possibly empty) Map containing the
currently available initialization parameters that will be used to
initialize the Servlet or Filter represented by this Registration
object.
|
Collection<String> |
getMappings()
Gets the currently available mappings of the
Servlet represented by this
ServletRegistration . |
String |
getName()
Gets the name of the Servlet or Filter that is represented by this
Registration.
|
String |
getRunAsRole()
Gets the name of the runAs role of the Servlet represented by this
ServletRegistration . |
void |
setAsyncSupported(boolean isAsyncSupported)
Configures the Servlet or Filter represented by this dynamic
Registration as supporting asynchronous operations or not.
|
boolean |
setInitParameter(String name,
String value)
Sets the initialization parameter with the given name and value
on the Servlet or Filter that is represented by this Registration.
|
Set<String> |
setInitParameters(Map<String,String> initParameters)
Sets the given initialization parameters on the Servlet or Filter
that is represented by this Registration.
|
void |
setLoadOnStartup(int loadOnStartup)
Sets the
loadOnStartup priority on the Servlet
represented by this dynamic ServletRegistration. |
void |
setMultipartConfig(MultipartConfigElement multipartConfig)
Sets the
MultipartConfigElement to be applied to the
mappings defined for this ServletRegistration . |
void |
setRunAsRole(String roleName)
Sets the name of the
runAs role for this
ServletRegistration . |
Set<String> |
setServletSecurity(ServletSecurityElement constraint)
Sets the
ServletSecurityElement to be applied to the
mappings defined for this ServletRegistration . |
public ServletRegistrationImpl(ServletInfo servletInfo, ManagedServlet managedServlet, Deployment deployment)
public void setLoadOnStartup(int loadOnStartup)
ServletRegistration.Dynamic
loadOnStartup
priority on the Servlet
represented by this dynamic ServletRegistration.
A loadOnStartup value of greater than or equal to
zero indicates to the container the initialization priority of
the Servlet. In this case, the container must instantiate and
initialize the Servlet during the initialization phase of the
ServletContext, that is, after it has invoked all of the
ServletContextListener objects configured for the ServletContext
at their ServletContextListener.contextInitialized(javax.servlet.ServletContextEvent)
method.
If loadOnStartup is a negative integer, the container is free to instantiate and initialize the Servlet lazily.
The default value for loadOnStartup is -1
.
A call to this method overrides any previous setting.
setLoadOnStartup
in interface ServletRegistration.Dynamic
loadOnStartup
- the initialization priority of the Servletpublic Set<String> setServletSecurity(ServletSecurityElement constraint)
ServletRegistration.Dynamic
ServletSecurityElement
to be applied to the
mappings defined for this ServletRegistration
.
This method applies to all mappings added to this
ServletRegistration
up until the point that the
ServletContext
from which it was obtained has been
initialized.
If a URL pattern of this ServletRegistration is an exact target
of a security-constraint
that was established via
the portable deployment descriptor, then this method does not
change the security-constraint
for that pattern,
and the pattern will be included in the return value.
If a URL pattern of this ServletRegistration is an exact
target of a security constraint that was established via the
ServletSecurity
annotation
or a previous call to this method, then this method replaces
the security constraint for that pattern.
If a URL pattern of this ServletRegistration is neither the
exact target of a security constraint that was established via
the ServletSecurity
annotation
or a previous call to this method, nor the exact target of a
security-constraint
in the portable deployment
descriptor, then this method establishes the security constraint
for that pattern from the argument
ServletSecurityElement
.
setServletSecurity
in interface ServletRegistration.Dynamic
constraint
- the ServletSecurityElement
to be applied
to the patterns mapped to this ServletRegistrationsecurity-constraint
that was
established via the portable deployment descriptor. This method
has no effect on the patterns included in the returned setpublic void setMultipartConfig(MultipartConfigElement multipartConfig)
ServletRegistration.Dynamic
MultipartConfigElement
to be applied to the
mappings defined for this ServletRegistration
. If this
method is called multiple times, each successive call overrides the
effects of the former.setMultipartConfig
in interface ServletRegistration.Dynamic
multipartConfig
- the MultipartConfigElement
to be
applied to the patterns mapped to the registrationpublic void setRunAsRole(String roleName)
ServletRegistration.Dynamic
runAs
role for this
ServletRegistration
.setRunAsRole
in interface ServletRegistration.Dynamic
roleName
- the name of the runAs
rolepublic void setAsyncSupported(boolean isAsyncSupported)
Registration.Dynamic
By default, servlet and filters do not support asynchronous operations.
A call to this method overrides any previous setting.
setAsyncSupported
in interface Registration.Dynamic
isAsyncSupported
- true if the Servlet or Filter represented
by this dynamic Registration supports asynchronous operations,
false otherwisepublic Set<String> addMapping(String... urlPatterns)
ServletRegistration
If any of the specified URL patterns are already mapped to a different Servlet, no updates will be performed.
If this method is called multiple times, each successive call adds to the effects of the former.
addMapping
in interface ServletRegistration
urlPatterns
- the URL patterns of the servlet mappingpublic Collection<String> getMappings()
ServletRegistration
ServletRegistration
.
If permitted, any changes to the returned Collection
must not
affect this ServletRegistration
.
getMappings
in interface ServletRegistration
Collection
of the currently
available mappings of the Servlet represented by this
ServletRegistration
public String getRunAsRole()
ServletRegistration
ServletRegistration
.getRunAsRole
in interface ServletRegistration
public String getName()
Registration
getName
in interface Registration
public String getClassName()
Registration
getClassName
in interface Registration
public boolean setInitParameter(String name, String value)
Registration
setInitParameter
in interface Registration
name
- the initialization parameter namevalue
- the initialization parameter valuepublic String getInitParameter(String name)
Registration
getInitParameter
in interface Registration
name
- the name of the initialization parameter whose value is
requestedpublic Set<String> setInitParameters(Map<String,String> initParameters)
Registration
The given map of initialization parameters is processed
by-value, i.e., for each initialization parameter contained
in the map, this method calls Registration.setInitParameter(String,String)
.
If that method would return false for any of the
initialization parameters in the given map, no updates will be
performed, and false will be returned. Likewise, if the map contains
an initialization parameter with a null name or value, no
updates will be performed, and an IllegalArgumentException will be
thrown.
setInitParameters
in interface Registration
initParameters
- the initialization parameterspublic Map<String,String> getInitParameters()
Registration
getInitParameters
in interface Registration
Copyright © 2017 JBoss by Red Hat. All rights reserved.