public class ServletRegistration extends Registration implements javax.servlet.ServletRegistration.Dynamic, java.lang.Comparable<ServletRegistration>
Servlet registered with the WebappContext.| Modifier and Type | Field and Description |
|---|---|
protected ExpectationHandler |
expectationHandler |
protected boolean |
isAsyncSupported |
protected int |
loadOnStartup |
protected javax.servlet.Servlet |
servlet |
protected java.lang.Class<? extends javax.servlet.Servlet> |
servletClass |
protected ArraySet<java.lang.String> |
urlPatterns |
className, ctx, initParameters, name| Modifier | Constructor and Description |
|---|---|
protected |
ServletRegistration(WebappContext ctx,
java.lang.String name,
java.lang.Class<? extends javax.servlet.Servlet> servletClass)
Creates a new ServletRegistration associated with the specified
WebappContext. |
protected |
ServletRegistration(WebappContext ctx,
java.lang.String name,
javax.servlet.Servlet servlet)
Creates a new ServletRegistration associated with the specified
WebappContext. |
protected |
ServletRegistration(WebappContext ctx,
java.lang.String name,
java.lang.String servletClassName)
Creates a new ServletRegistration associated with the specified
WebappContext. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
int |
compareTo(ServletRegistration o) |
ExpectationHandler |
getExpectationHandler()
Get the
ExpectationHandler responsible for processing
Expect: header (for example "Expect: 100-Continue"). |
java.util.Collection<java.lang.String> |
getMappings()
Gets the currently available mappings of the
Servlet represented by this
ServletRegistration. |
java.lang.String |
getRunAsRole() |
void |
setAsyncSupported(boolean isAsyncSupported) |
void |
setExpectationHandler(ExpectationHandler expectationHandler)
Set the
ExpectationHandler responsible for processing
Expect: header (for example "Expect: 100-Continue"). |
void |
setLoadOnStartup(int loadOnStartup)
Sets the
loadOnStartup priority on the Servlet
represented by this dynamic ServletRegistration. |
void |
setMultipartConfig(javax.servlet.MultipartConfigElement multipartConfig) |
void |
setRunAsRole(java.lang.String roleName) |
java.util.Set<java.lang.String> |
setServletSecurity(javax.servlet.ServletSecurityElement constraint) |
java.lang.String |
toString() |
equals, getClassName, getInitParameter, getInitParameters, getName, hashCode, setInitParameter, setInitParametersprotected java.lang.Class<? extends javax.servlet.Servlet> servletClass
protected ArraySet<java.lang.String> urlPatterns
protected javax.servlet.Servlet servlet
protected int loadOnStartup
protected ExpectationHandler expectationHandler
protected boolean isAsyncSupported
protected ServletRegistration(WebappContext ctx, java.lang.String name, java.lang.String servletClassName)
WebappContext.ctx - the owning WebappContext.name - the name of the Filter.servletClassName - the fully qualified class name of the Servlet
implementation.protected ServletRegistration(WebappContext ctx, java.lang.String name, javax.servlet.Servlet servlet)
WebappContext.ctx - the owning WebappContext.name - the name of the Filter.servlet - the Servlet instance.protected ServletRegistration(WebappContext ctx, java.lang.String name, java.lang.Class<? extends javax.servlet.Servlet> servletClass)
WebappContext.ctx - the owning WebappContext.name - the name of the Filter.servletClass - the class of the Servlet implementation.public 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.
addMapping in interface 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 in interface javax.servlet.ServletRegistrationCollection of the currently
available mappings of the Servlet represented by this
ServletRegistrationpublic 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
WebappContext, that is, after it has invoked all of the
ServletContextListener objects configured for the WebappContext
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 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 ExpectationHandler getExpectationHandler()
ExpectationHandler responsible for processing
Expect: header (for example "Expect: 100-Continue").ExpectationHandler responsible for processing
Expect: header (for example "Expect: 100-Continue").public java.util.Set<java.lang.String> setServletSecurity(javax.servlet.ServletSecurityElement constraint)
setServletSecurity in interface javax.servlet.ServletRegistration.Dynamicpublic void setMultipartConfig(javax.servlet.MultipartConfigElement multipartConfig)
setMultipartConfig in interface javax.servlet.ServletRegistration.Dynamicpublic java.lang.String getRunAsRole()
getRunAsRole in interface javax.servlet.ServletRegistrationpublic void setRunAsRole(java.lang.String roleName)
setRunAsRole in interface javax.servlet.ServletRegistration.Dynamicpublic void setAsyncSupported(boolean isAsyncSupported)
setAsyncSupported in interface javax.servlet.Registration.Dynamicpublic void setExpectationHandler(ExpectationHandler expectationHandler)
ExpectationHandler responsible for processing
Expect: header (for example "Expect: 100-Continue").expectationHandler - the ExpectationHandler responsible
for processing Expect: header (for example "Expect: 100-Continue").public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(ServletRegistration o)
compareTo in interface java.lang.Comparable<ServletRegistration>Copyright © 2014 Oracle Corporation. All Rights Reserved.