public class TPServletRegistration extends TPRegistration<javax.servlet.Servlet> implements javax.servlet.ServletRegistration.Dynamic
context, instance, name| 构造器和说明 |
|---|
TPServletRegistration(TPServletContext context,
java.lang.String name,
javax.servlet.Servlet instance) |
| 限定符和类型 | 方法和说明 |
|---|---|
java.util.Set<java.lang.String> |
addMapping(java.lang.String... urlPatterns)
Adds a servlet mapping with the given URL patterns for the Servlet
represented by this ServletRegistration.
|
java.util.Collection<java.lang.String> |
getMappings()
Gets the currently available mappings of the
Servlet represented by this
ServletRegistration. |
java.lang.String |
getRunAsRole()
Gets the name of the runAs role of the Servlet represented by this
ServletRegistration. |
javax.servlet.Servlet |
getServletInstance() |
void |
loadAnnotation(javax.servlet.annotation.WebServlet ws) |
void |
setLoadOnStartup(int loadOnStartup)
Sets the
loadOnStartup priority on the Servlet
represented by this dynamic ServletRegistration. |
void |
setMultipartConfig(javax.servlet.MultipartConfigElement multipartConfig)
Sets the
MultipartConfigElement to be applied to the
mappings defined for this ServletRegistration. |
void |
setRunAsRole(java.lang.String roleName)
Sets the name of the
runAs role for this
ServletRegistration. |
java.util.Set<java.lang.String> |
setServletSecurity(javax.servlet.ServletSecurityElement constraint)
Sets the
ServletSecurityElement to be applied to the
mappings defined for this ServletRegistration. |
getClassName, getInitParameter, getInitParameters, getName, setAsyncSupported, setInitParameter, setInitParameterspublic TPServletRegistration(TPServletContext context, java.lang.String name, javax.servlet.Servlet instance)
public void loadAnnotation(javax.servlet.annotation.WebServlet ws)
public javax.servlet.Servlet getServletInstance()
public void setLoadOnStartup(int loadOnStartup)
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 在接口中 javax.servlet.ServletRegistration.DynamicloadOnStartup - the initialization priority of the Servletjava.lang.IllegalStateException - if the ServletContext from which
this ServletRegistration was obtained has already been initializedpublic java.util.Set<java.lang.String> setServletSecurity(javax.servlet.ServletSecurityElement constraint)
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.
The returned set is not backed by the Dynamic object,
so changes in the returned set are not reflected in the
Dynamic object, and vice-versa.
setServletSecurity 在接口中 javax.servlet.ServletRegistration.Dynamicconstraint - 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 setjava.lang.IllegalArgumentException - if constraint is nulljava.lang.IllegalStateException - if the ServletContext from
which this ServletRegistration was obtained has
already been initializedpublic void setMultipartConfig(javax.servlet.MultipartConfigElement multipartConfig)
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 在接口中 javax.servlet.ServletRegistration.DynamicmultipartConfig - the MultipartConfigElement to be
applied to the patterns mapped to the registrationjava.lang.IllegalArgumentException - if multipartConfig is
nulljava.lang.IllegalStateException - if the ServletContext from
which this ServletRegistration was obtained has already been
initializedpublic void setRunAsRole(java.lang.String roleName)
runAs role for this
ServletRegistration.setRunAsRole 在接口中 javax.servlet.ServletRegistration.DynamicroleName - the name of the runAs rolejava.lang.IllegalArgumentException - if roleName is nulljava.lang.IllegalStateException - if the ServletContext from
which this ServletRegistration was obtained has already been
initializedpublic java.util.Set<java.lang.String> addMapping(java.lang.String... urlPatterns)
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.
The returned set is not backed by the ServletRegistration
object, so changes in the returned set are not reflected in the
ServletRegistration object, and vice-versa.
addMapping 在接口中 javax.servlet.ServletRegistrationurlPatterns - the URL patterns of the servlet mappingjava.lang.IllegalArgumentException - if urlPatterns is null
or emptyjava.lang.IllegalStateException - if the ServletContext from which this
ServletRegistration was obtained has already been initializedpublic java.util.Collection<java.lang.String> getMappings()
ServletRegistration.
If permitted, any changes to the returned Collection must not
affect this ServletRegistration.
getMappings 在接口中 javax.servlet.ServletRegistrationCollection of the currently
available mappings of the Servlet represented by this
ServletRegistrationpublic java.lang.String getRunAsRole()
ServletRegistration.getRunAsRole 在接口中 javax.servlet.ServletRegistration