Top Description Fields Constructors Methods
org.glassfish.grizzly.servlet

public Class FilterRegistration

extends Registration
implements Dynamic
Class Inheritance
All Implemented Interfaces
jakarta.servlet.FilterRegistration.Dynamic, jakarta.servlet.Registration.Dynamic, jakarta.servlet.Registration, jakarta.servlet.FilterRegistration
Imports
java.util.Collection, .EnumSet, .HashMap, jakarta.servlet.DispatcherType, .Filter

Allows customization of a Filter registered with the WebappContext.
Since
2.2

Field Summary

Modifier and TypeField and Description
protected Filter
protected Class<? extends Filter>
protected boolean
Inherited from org.glassfish.grizzly.servlet.Registration:
classNamectxinitParametersname

Constructor Summary

AccessConstructor and Description
protected
FilterRegistration(final WebappContext
the owning WebappContext.
ctx
,
final String
the name of the Filter.
name
,
final String
the fully qualified class name of the Filter implementation.
filterClassName
)

Creates a new FilterRegistration associated with the specified WebappContext.

protected
FilterRegistration(final WebappContext
the owning WebappContext.
ctx
,
final String
name the name of the Filter.
name
,
final Class<? extends Filter>
the class of the Filter implementation
filter
)

Creates a new FilterRegistration associated with the specified WebappContext.

protected
FilterRegistration(final WebappContext
the owning WebappContext.
ctx
,
final String
name the name of the Filter.
name
,
final Filter
the Filter instance.
filter
)

Creates a new FilterRegistration associated with the specified WebappContext.

Method Summary

Modifier and TypeMethod and Description
public void
addMappingForServletNames(EnumSet<DispatcherType>
the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be used
dispatcherTypes
,
String...
the servlet names of the filter mapping
servletNames
)

Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.

public void
addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames)

Implements jakarta.servlet.FilterRegistration.addMappingForServletNames.

Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.

public void
addMappingForUrlPatterns(EnumSet<DispatcherType>
the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be used
dispatcherTypes
,
String...
the url patterns of the filter mapping
urlPatterns
)

Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.

public void
addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns)

Implements jakarta.servlet.FilterRegistration.addMappingForUrlPatterns.

Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.

public Collection<String>

Returns:

a (possibly empty) Collection of the currently available servlet name mappings of the Filter represented by this FilterRegistration
getServletNameMappings
()

Implements jakarta.servlet.FilterRegistration.getServletNameMappings.

Gets the currently available servlet name mappings of the Filter represented by this FilterRegistration.

public Collection<String>

Returns:

a (possibly empty) Collection of the currently available URL pattern mappings of the Filter represented by this FilterRegistration
getUrlPatternMappings
()

Implements jakarta.servlet.FilterRegistration.getUrlPatternMappings.

Gets the currently available URL pattern mappings of the Filter represented by this FilterRegistration.

public void
setAsyncSupported(boolean isAsyncSupported)

Implements jakarta.servlet.Registration.Dynamic.setAsyncSupported.

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

Inherited from org.glassfish.grizzly.servlet.Registration:
equalsgetClassNamegetInitParametergetInitParametersgetNamehashCodesetInitParametersetInitParameters

Field Detail

filterback to summary
protected Filter filter
filterClassback to summary
protected Class<? extends Filter> filterClass
isAsyncSupportedback to summary
protected boolean isAsyncSupported

Constructor Detail

FilterRegistrationback to summary
protected FilterRegistration(final WebappContext ctx, final String name, final String filterClassName)

Creates a new FilterRegistration associated with the specified WebappContext.

Parameters
ctx:WebappContext

the owning WebappContext.

name:String

the name of the Filter.

filterClassName:String

the fully qualified class name of the Filter implementation.

FilterRegistrationback to summary
protected FilterRegistration(final WebappContext ctx, final String name, final Class<? extends Filter> filter)

Creates a new FilterRegistration associated with the specified WebappContext.

Parameters
ctx:WebappContext

the owning WebappContext.

name:String

name the name of the Filter.

filter:Class<? extends Filter>

the class of the Filter implementation

FilterRegistrationback to summary
protected FilterRegistration(final WebappContext ctx, final String name, final Filter filter)

Creates a new FilterRegistration associated with the specified WebappContext.

Parameters
ctx:WebappContext

the owning WebappContext.

name:String

name the name of the Filter.

filter:Filter

the Filter instance.

Method Detail

addMappingForServletNamesback to summary
public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, String... servletNames)

Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.

Filter mappings are matched in the order in which they were added.

If this method is called multiple times, each successive call adds to the effects of the former.

Parameters
dispatcherTypes:EnumSet<DispatcherType>

the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be used

servletNames:String[]

the servlet names of the filter mapping

Exceptions
IllegalArgumentException:
if servletNames is null or empty
IllegalStateException:
if the ServletContext from which this FilterRegistration was obtained has already been initialized
addMappingForServletNamesback to summary
public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames)

Implements jakarta.servlet.FilterRegistration.addMappingForServletNames.

Doc from jakarta.servlet.FilterRegistration.addMappingForServletNames.

Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.

Filter mappings are matched in the order in which they were added.

Depending on the value of the isMatchAfter parameter, the given filter mapping will be considered after or before any declared filter mappings of the ServletContext from which this FilterRegistration was obtained.

If this method is called multiple times, each successive call adds to the effects of the former.

Annotations
@Override
addMappingForUrlPatternsback to summary
public void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, String... urlPatterns)

Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.

Filter mappings are matched in the order in which they were added.

If this method is called multiple times, each successive call adds to the effects of the former.

Parameters
dispatcherTypes:EnumSet<DispatcherType>

the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be used

urlPatterns:String[]

the url patterns of the filter mapping

Exceptions
IllegalArgumentException:
if urlPatterns is null or empty
IllegalStateException:
if the ServletContext from which this FilterRegistration was obtained has already been initialized
addMappingForUrlPatternsback to summary
public void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns)

Implements jakarta.servlet.FilterRegistration.addMappingForUrlPatterns.

Doc from jakarta.servlet.FilterRegistration.addMappingForUrlPatterns.

Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.

Filter mappings are matched in the order in which they were added.

Depending on the value of the isMatchAfter parameter, the given filter mapping will be considered after or before any declared filter mappings of the ServletContext from which this FilterRegistration was obtained.

If this method is called multiple times, each successive call adds to the effects of the former.

Annotations
@Override
getServletNameMappingsback to summary
public Collection<String> getServletNameMappings()

Implements jakarta.servlet.FilterRegistration.getServletNameMappings.

Gets the currently available servlet name mappings of the Filter represented by this FilterRegistration.

If permitted, any changes to the returned Collection must not affect this FilterRegistration.

Returns:Collection<String>

a (possibly empty) Collection of the currently available servlet name mappings of the Filter represented by this FilterRegistration

Annotations
@Override
getUrlPatternMappingsback to summary
public Collection<String> getUrlPatternMappings()

Implements jakarta.servlet.FilterRegistration.getUrlPatternMappings.

Gets the currently available URL pattern mappings of the Filter represented by this FilterRegistration.

If permitted, any changes to the returned Collection must not affect this FilterRegistration.

Returns:Collection<String>

a (possibly empty) Collection of the currently available URL pattern mappings of the Filter represented by this FilterRegistration

Annotations
@Override
setAsyncSupportedback to summary
public void setAsyncSupported(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.

Annotations
@Override