Top Fields Constructors Methods
io.undertow.servlet.spec

public Class ServletRegistrationImpl

extends Object
implements ServletRegistration, Dynamic
Class Inheritance
All Implemented Interfaces
jakarta.servlet.ServletRegistration.Dynamic, jakarta.servlet.Registration.Dynamic, jakarta.servlet.Registration, jakarta.servlet.ServletRegistration
Imports
java.util.Collection, .HashSet, .Map, .Set, jakarta.servlet.HttpMethodConstraintElement, .MultipartConfigElement, .ServletRegistration, .ServletSecurityElement, jakarta.servlet.annotation.ServletSecurity, io.undertow.UndertowMessages, io.undertow.servlet.api.Deployment, .DeploymentInfo, .HttpMethodSecurityInfo, .SecurityConstraint, .SecurityInfo, .SecurityInfo.EmptyRoleSemantic, .ServletInfo, .ServletSecurityInfo, .TransportGuaranteeType, .WebResourceCollection, io.undertow.servlet.core.ManagedServlet

Author
Stuart Douglas

Field Summary

Modifier and TypeField and Description
private final Deployment
private final ManagedServlet
private final ServletInfo

Constructor Summary

AccessConstructor and Description
public
ServletRegistrationImpl(final ServletInfo servletInfo, ManagedServlet managedServlet, final Deployment deployment)

Method Summary

Modifier and TypeMethod and Description
public Set<String>
addMapping(final String...
the URL patterns of the servlet mapping
urlPatterns
)

Implements jakarta.servlet.ServletRegistration.addMapping.

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

private SecurityInfo.EmptyRoleSemantic
public String
getClassName()

Implements jakarta.servlet.Registration.getClassName.

Gets the fully qualified class name of the Servlet or Filter that is represented by this Registration.

public String
getInitParameter(final String
the name of the initialization parameter whose value is requested
name
)

Implements jakarta.servlet.Registration.getInitParameter.

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.

public Map<String, String>
getInitParameters()

Implements jakarta.servlet.Registration.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.

public Collection<String>
getMappings()

Implements jakarta.servlet.ServletRegistration.getMappings.

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

public String
getName()

Implements jakarta.servlet.Registration.getName.

Gets the name of the Servlet or Filter that is represented by this Registration.

public String
getRunAsRole()

Implements jakarta.servlet.ServletRegistration.getRunAsRole.

Gets the name of the runAs role of the Servlet represented by this ServletRegistration.

public void
setAsyncSupported(final boolean
true if the Servlet or Filter represented by this dynamic Registration supports asynchronous operations, false otherwise
isAsyncSupported
)

Implements jakarta.servlet.Registration.Dynamic.setAsyncSupported.

Configures the Servlet or Filter represented by this dynamic Registration as supporting asynchronous operations or not.

public boolean
setInitParameter(final String
the initialization parameter name
name
,
final String
the initialization parameter value
value
)

Implements jakarta.servlet.Registration.setInitParameter.

Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.

public Set<String>
setInitParameters(final Map<String, String>
the initialization parameters
initParameters
)

Implements jakarta.servlet.Registration.setInitParameters.

Sets the given initialization parameters on the Servlet or Filter that is represented by this Registration.

public void
setLoadOnStartup(final int
the initialization priority of the Servlet
loadOnStartup
)

Implements jakarta.servlet.ServletRegistration.Dynamic.setLoadOnStartup.

Sets the loadOnStartup priority on the Servlet represented by this dynamic ServletRegistration.

public void
setMultipartConfig(final MultipartConfigElement
the MultipartConfigElement to be applied to the patterns mapped to the registration
multipartConfig
)

Implements jakarta.servlet.ServletRegistration.Dynamic.setMultipartConfig.

Sets the MultipartConfigElement to be applied to the mappings defined for this ServletRegistration.

public void
setRunAsRole(final String
the name of the runAs role
roleName
)

Implements jakarta.servlet.ServletRegistration.Dynamic.setRunAsRole.

Sets the name of the runAs role for this ServletRegistration.

public Set<String>
setServletSecurity(final ServletSecurityElement
the ServletSecurityElement to be applied to the patterns mapped to this ServletRegistration
constraint
)

Implements jakarta.servlet.ServletRegistration.Dynamic.setServletSecurity.

Sets the ServletSecurityElement to be applied to the mappings defined for this ServletRegistration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

deploymentback to summary
private final Deployment deployment
managedServletback to summary
private final ManagedServlet managedServlet
servletInfoback to summary
private final ServletInfo servletInfo

Constructor Detail

ServletRegistrationImplback to summary
public ServletRegistrationImpl(final ServletInfo servletInfo, ManagedServlet managedServlet, final Deployment deployment)

Method Detail

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

Implements jakarta.servlet.ServletRegistration.addMapping.

Doc from jakarta.servlet.ServletRegistration.addMapping.

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 of the servlet mapping

Returns:Set<String>

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

Annotations
@Override
emptyRoleSemanticback to summary
private SecurityInfo.EmptyRoleSemantic emptyRoleSemantic(final ServletSecurity.EmptyRoleSemantic emptyRoleSemantic)
getClassNameback to summary
public String getClassName()

Implements jakarta.servlet.Registration.getClassName.

Doc from jakarta.servlet.Registration.getClassName.

Gets the fully qualified class name of the Servlet or Filter that is represented by this Registration.

Returns:String

the fully qualified class name of the Servlet or Filter that is represented by this Registration, or null if this Registration is preliminary

Annotations
@Override
getInitParameterback to summary
public String getInitParameter(final String name)

Implements jakarta.servlet.Registration.getInitParameter.

Doc from jakarta.servlet.Registration.getInitParameter.

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.

Parameters
name:String

the name of the initialization parameter whose value is requested

Returns:String

the value of the initialization parameter with the given name, or null if no initialization parameter with the given name exists

Annotations
@Override
getInitParametersback to summary
public Map<String, String> getInitParameters()

Implements jakarta.servlet.Registration.getInitParameters.

Doc from jakarta.servlet.Registration.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.

Returns:Map<String, String>

Map containing the currently available initialization parameters that will be used to initialize the Servlet or Filter represented by this Registration object

Annotations
@Override
getMappingsback to summary
public Collection<String> getMappings()

Implements jakarta.servlet.ServletRegistration.getMappings.

Doc from jakarta.servlet.ServletRegistration.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

Annotations
@Override
getNameback to summary
public String getName()

Implements jakarta.servlet.Registration.getName.

Doc from jakarta.servlet.Registration.getName.

Gets the name of the Servlet or Filter that is represented by this Registration.

Returns:String

the name of the Servlet or Filter that is represented by this Registration

Annotations
@Override
getRunAsRoleback to summary
public String getRunAsRole()

Implements jakarta.servlet.ServletRegistration.getRunAsRole.

Doc from jakarta.servlet.ServletRegistration.getRunAsRole.

Gets the name of the runAs role of the Servlet represented by this ServletRegistration.

Returns:String

the name of the runAs role, or null if the Servlet is configured to run as its caller

Annotations
@Override
setAsyncSupportedback to summary
public void setAsyncSupported(final boolean isAsyncSupported)

Implements jakarta.servlet.Registration.Dynamic.setAsyncSupported.

Doc from jakarta.servlet.Registration.Dynamic.setAsyncSupported.

Configures the Servlet or Filter represented by this dynamic Registration as supporting asynchronous operations or not.

By default, servlet and filters do not support asynchronous operations.

A call to this method overrides any previous setting.

Parameters
isAsyncSupported:boolean

true if the Servlet or Filter represented by this dynamic Registration supports asynchronous operations, false otherwise

Annotations
@Override
setInitParameterback to summary
public boolean setInitParameter(final String name, final String value)

Implements jakarta.servlet.Registration.setInitParameter.

Doc from jakarta.servlet.Registration.setInitParameter.

Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.

Parameters
name:String

the initialization parameter name

value:String

the initialization parameter value

Returns:boolean

true if the update was successful, i.e., an initialization parameter with the given name did not already exist for the Servlet or Filter represented by this Registration, and false otherwise

Annotations
@Override
setInitParametersback to summary
public Set<String> setInitParameters(final Map<String, String> initParameters)

Implements jakarta.servlet.Registration.setInitParameters.

Doc from jakarta.servlet.Registration.setInitParameters.

Sets the given initialization parameters on the Servlet or Filter that is represented by this Registration.

The given map of initialization parameters is processed by-value, i.e., for each initialization parameter contained in the map, this method calls 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.

The returned set is not backed by the Registration object, so changes in the returned set are not reflected in the Registration object, and vice-versa.

Parameters
initParameters:Map<String, String>

the initialization parameters

Returns:Set<String>

the (possibly empty) Set of initialization parameter names that are in conflict

Annotations
@Override
setLoadOnStartupback to summary
public void setLoadOnStartup(final int loadOnStartup)

Implements jakarta.servlet.ServletRegistration.Dynamic.setLoadOnStartup.

Doc from jakarta.servlet.ServletRegistration.Dynamic.setLoadOnStartup.

Sets the 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 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.

Parameters
loadOnStartup:int

the initialization priority of the Servlet

Annotations
@Override
setMultipartConfigback to summary
public void setMultipartConfig(final MultipartConfigElement multipartConfig)

Implements jakarta.servlet.ServletRegistration.Dynamic.setMultipartConfig.

Doc from jakarta.servlet.ServletRegistration.Dynamic.setMultipartConfig.

Sets the 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.

Parameters
multipartConfig:MultipartConfigElement

the MultipartConfigElement to be applied to the patterns mapped to the registration

Annotations
@Override
setRunAsRoleback to summary
public void setRunAsRole(final String roleName)

Implements jakarta.servlet.ServletRegistration.Dynamic.setRunAsRole.

Doc from jakarta.servlet.ServletRegistration.Dynamic.setRunAsRole.

Sets the name of the runAs role for this ServletRegistration.

Parameters
roleName:String

the name of the runAs role

Annotations
@Override
setServletSecurityback to summary
public Set<String> setServletSecurity(final ServletSecurityElement constraint)

Implements jakarta.servlet.ServletRegistration.Dynamic.setServletSecurity.

Doc from jakarta.servlet.ServletRegistration.Dynamic.setServletSecurity.

Sets the 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 jakarta.servlet.annotation.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 jakarta.servlet.annotation.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.

Parameters
constraint:ServletSecurityElement

the ServletSecurityElement to be applied to the patterns mapped to this ServletRegistration

Returns:Set<String>

the (possibly empty) Set of URL patterns that were already the exact target of a security-constraint that was established via the portable deployment descriptor. This method has no effect on the patterns included in the returned set

Annotations
@Override