Package org.glassfish.grizzly.servlet
Class FilterRegistration
- java.lang.Object
-
- org.glassfish.grizzly.servlet.Registration
-
- org.glassfish.grizzly.servlet.FilterRegistration
-
- All Implemented Interfaces:
jakarta.servlet.FilterRegistration,jakarta.servlet.FilterRegistration.Dynamic,jakarta.servlet.Registration,jakarta.servlet.Registration.Dynamic
public class FilterRegistration extends Registration implements jakarta.servlet.FilterRegistration.Dynamic
Allows customization of aFilterregistered with theWebappContext.- Since:
- 2.2
-
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.servlet.Filterfilterprotected Class<? extends jakarta.servlet.Filter>filterClassprotected booleanisAsyncSupported-
Fields inherited from class org.glassfish.grizzly.servlet.Registration
className, ctx, initParameters, name
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFilterRegistration(WebappContext ctx, String name, jakarta.servlet.Filter filter)Creates a new FilterRegistration associated with the specifiedWebappContext.protectedFilterRegistration(WebappContext ctx, String name, Class<? extends jakarta.servlet.Filter> filter)Creates a new FilterRegistration associated with the specifiedWebappContext.protectedFilterRegistration(WebappContext ctx, String name, String filterClassName)Creates a new FilterRegistration associated with the specifiedWebappContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMappingForServletNames(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames)voidaddMappingForServletNames(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, String... servletNames)Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.voidaddMappingForUrlPatterns(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns)voidaddMappingForUrlPatterns(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, String... urlPatterns)Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.Collection<String>getServletNameMappings()Gets the currently available servlet name mappings of the Filter represented by thisFilterRegistration.Collection<String>getUrlPatternMappings()Gets the currently available URL pattern mappings of the Filter represented by thisFilterRegistration.voidsetAsyncSupported(boolean isAsyncSupported)-
Methods inherited from class org.glassfish.grizzly.servlet.Registration
equals, getClassName, getInitParameter, getInitParameters, getName, hashCode, setInitParameter, setInitParameters
-
-
-
-
Field Detail
-
filterClass
protected Class<? extends jakarta.servlet.Filter> filterClass
-
filter
protected jakarta.servlet.Filter filter
-
isAsyncSupported
protected boolean isAsyncSupported
-
-
Constructor Detail
-
FilterRegistration
protected FilterRegistration(WebappContext ctx, String name, String filterClassName)
Creates a new FilterRegistration associated with the specifiedWebappContext.- Parameters:
ctx- the owningWebappContext.name- the name of the Filter.filterClassName- the fully qualified class name of theFilterimplementation.
-
FilterRegistration
protected FilterRegistration(WebappContext ctx, String name, Class<? extends jakarta.servlet.Filter> filter)
Creates a new FilterRegistration associated with the specifiedWebappContext.- Parameters:
ctx- the owningWebappContext.name- name the name of the Filter.filter- the class of theFilterimplementation
-
FilterRegistration
protected FilterRegistration(WebappContext ctx, String name, jakarta.servlet.Filter filter)
Creates a new FilterRegistration associated with the specifiedWebappContext.- Parameters:
ctx- the owningWebappContext.name- name the name of the Filter.filter- theFilterinstance.
-
-
Method Detail
-
addMappingForServletNames
public void addMappingForServletNames(EnumSet<jakarta.servlet.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- the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be usedservletNames- the servlet names of the filter mapping- Throws:
IllegalArgumentException- if servletNames is null or emptyIllegalStateException- if the ServletContext from which this FilterRegistration was obtained has already been initialized
-
addMappingForServletNames
public void addMappingForServletNames(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames)
- Specified by:
addMappingForServletNamesin interfacejakarta.servlet.FilterRegistration
-
getServletNameMappings
public Collection<String> getServletNameMappings()
Gets the currently available servlet name mappings of the Filter represented by thisFilterRegistration.If permitted, any changes to the returned
Collectionmust not affect thisFilterRegistration.- Specified by:
getServletNameMappingsin interfacejakarta.servlet.FilterRegistration- Returns:
- a (possibly empty)
Collectionof the currently available servlet name mappings of the Filter represented by thisFilterRegistration
-
addMappingForUrlPatterns
public void addMappingForUrlPatterns(EnumSet<jakarta.servlet.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- the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be usedurlPatterns- the url patterns of the filter mapping- Throws:
IllegalArgumentException- if urlPatterns is null or emptyIllegalStateException- if the ServletContext from which this FilterRegistration was obtained has already been initialized
-
addMappingForUrlPatterns
public void addMappingForUrlPatterns(EnumSet<jakarta.servlet.DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns)
- Specified by:
addMappingForUrlPatternsin interfacejakarta.servlet.FilterRegistration
-
getUrlPatternMappings
public Collection<String> getUrlPatternMappings()
Gets the currently available URL pattern mappings of the Filter represented by thisFilterRegistration.If permitted, any changes to the returned
Collectionmust not affect thisFilterRegistration.- Specified by:
getUrlPatternMappingsin interfacejakarta.servlet.FilterRegistration- Returns:
- a (possibly empty)
Collectionof the currently available URL pattern mappings of the Filter represented by thisFilterRegistration
-
setAsyncSupported
public void setAsyncSupported(boolean isAsyncSupported)
- Specified by:
setAsyncSupportedin interfacejakarta.servlet.Registration.Dynamic
-
-