Top Description Inners Methods
jakarta.servlet

public Interface ServletRegistration

extends Registration
Known Direct Subinterfaces
jakarta.servlet.ServletRegistration.Dynamic
Imports
java.util.Collection, .Set

Interface through which a Servlet may be further configured.
Since
Servlet 3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ServletRegistration.Dynamic

Interface through which a Servlet registered via one of the addServlet methods on ServletContext may be further configured.

Method Summary

Modifier and TypeMethod and Description
public Set<String>

Returns:

the (possibly empty) Set of URL patterns that are already mapped to a different Servlet
addMapping
(String...
The URL patterns that this Servlet should be mapped to
urlPatterns
)

Adds a servlet mapping with the given URL patterns for the Servlet represented by this ServletRegistration.

public Collection<String>

Returns:

a (possibly empty) Collection of the currently available mappings of the Servlet represented by this ServletRegistration
getMappings
()

Gets the currently available mappings of the Servlet represented by this ServletRegistration.

public String

Returns:

the name of the user / group or null if none has been specified
getRunAsRole
()

Obtain the name of the user / group under which the Servlet has been configured to run.

Inherited from jakarta.servlet.Registration:
getClassNamegetInitParametergetInitParametersgetNamesetInitParametersetInitParameters

Method Detail

addMappingback to summary
public Set<String> addMapping(String... urlPatterns)

Adds a servlet mapping with the given URL patterns for the Servlet represented by this 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. 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.

Parameters
urlPatterns:String[]

The URL patterns that this Servlet should be mapped to

Returns:Set<String>

the (possibly empty) Set of URL patterns that are already mapped to a different Servlet

Exceptions
IllegalArgumentException:
if urlPattern is null or empty
IllegalStateException:
if the associated ServletContext has already been initialised
getMappingsback to summary
public Collection<String> getMappings()

Gets the currently available mappings of the Servlet represented by this ServletRegistration. If permitted, any changes to the returned Collection must not affect this ServletRegistration.

Returns:Collection<String>

a (possibly empty) Collection of the currently available mappings of the Servlet represented by this ServletRegistration

getRunAsRoleback to summary
public String getRunAsRole()

Obtain the name of the user / group under which the Servlet has been configured to run.

Returns:String

the name of the user / group or null if none has been specified

jakarta.servlet back to summary

public Interface ServletRegistration.Dynamic

extends ServletRegistration, Dynamic
Known Direct Implementers
org.apache.catalina.core.ApplicationServletRegistration

Interface through which a Servlet registered via one of the addServlet methods on ServletContext may be further configured.

Method Summary

Modifier and TypeMethod and Description
public void
setLoadOnStartup(int
The position in the order the Servlet should be started (higher numbers are started after lower numbers)
loadOnStartup
)

Set the loadOnStartup order for the Servlet

public void
setMultipartConfig(MultipartConfigElement
The configuration to associate with the Servlet
multipartConfig
)

Set the multi-part configuration for the associated Servlet.

public void
setRunAsRole(String
name of the user / group or null if none
roleName
)

Set the name of the user / group under which the Servlet should be configured to run.

public Set<String>

Returns:

urls currently mapped to this registration that are already present in web.xml
setServletSecurity
(ServletSecurityElement
new security constraints for this Servlet
constraint
)

Add security constraints to this Servlet.

Inherited from jakarta.servlet.Registration.Dynamic:
setAsyncSupported
Inherited from jakarta.servlet.ServletRegistration:
addMappinggetMappingsgetRunAsRole

Method Detail

setLoadOnStartupback to summary
public void setLoadOnStartup(int loadOnStartup)

Set the loadOnStartup order for the Servlet

Parameters
loadOnStartup:int

The position in the order the Servlet should be started (higher numbers are started after lower numbers)

setMultipartConfigback to summary
public void setMultipartConfig(MultipartConfigElement multipartConfig)

Set the multi-part configuration for the associated Servlet. To clear the multi-part configuration specify null as the new value.

Parameters
multipartConfig:MultipartConfigElement

The configuration to associate with the Servlet

setRunAsRoleback to summary
public void setRunAsRole(String roleName)

Set the name of the user / group under which the Servlet should be configured to run.

Parameters
roleName:String

name of the user / group or null if none

setServletSecurityback to summary
public Set<String> setServletSecurity(ServletSecurityElement constraint)

Add security constraints to this Servlet.

Parameters
constraint:ServletSecurityElement

new security constraints for this Servlet

Returns:Set<String>

urls currently mapped to this registration that are already present in web.xml