Class FilterRegistrationImpl
- All Implemented Interfaces:
FilterRegistration,FilterRegistration.Dynamic,Registration,Registration.Dynamic
- Author:
- Stuart Douglas
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.servlet.FilterRegistration
FilterRegistration.DynamicNested classes/interfaces inherited from interface jakarta.servlet.Registration
Registration.Dynamic -
Constructor Summary
ConstructorsConstructorDescriptionFilterRegistrationImpl(FilterInfo filterInfo, Deployment deployment, ServletContextImpl servletContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames) Adds a filter mapping with the given servlet names and dispatcher types for the Filter represented by this FilterRegistration.voidaddMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns) Adds a filter mapping with the given url patterns and dispatcher types for the Filter represented by this FilterRegistration.Gets the fully qualified class name of the Servlet or Filter that is represented by this Registration.getInitParameter(String name) 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.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.getName()Gets the name of the Servlet or Filter that is represented by this Registration.Gets the currently available servlet name mappings of the Filter represented by thisFilterRegistration.Gets the currently available URL pattern mappings of the Filter represented by thisFilterRegistration.voidsetAsyncSupported(boolean isAsyncSupported) Configures the Servlet or Filter represented by this dynamic Registration as supporting asynchronous operations or not.booleansetInitParameter(String name, String value) Sets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.setInitParameters(Map<String, String> initParameters) Sets the given initialization parameters on the Servlet or Filter that is represented by this Registration.
-
Constructor Details
-
FilterRegistrationImpl
public FilterRegistrationImpl(FilterInfo filterInfo, Deployment deployment, ServletContextImpl servletContext)
-
-
Method Details
-
addMappingForServletNames
public void addMappingForServletNames(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... servletNames) Description copied from interface:FilterRegistrationAdds 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.
- Specified by:
addMappingForServletNamesin interfaceFilterRegistration- Parameters:
dispatcherTypes- the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be usedisMatchAfter- true if the given filter mapping should be matched after any declared filter mappings, and false if it is supposed to be matched before any declared filter mappings of the ServletContext from which this FilterRegistration was obtainedservletNames- the servlet names of the filter mapping
-
getServletNameMappings
Description copied from interface:FilterRegistrationGets 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 interfaceFilterRegistration- Returns:
- a (possibly empty)
Collectionof the currently available servlet name mappings of the Filter represented by thisFilterRegistration
-
addMappingForUrlPatterns
public void addMappingForUrlPatterns(EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter, String... urlPatterns) Description copied from interface:FilterRegistrationAdds 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.
- Specified by:
addMappingForUrlPatternsin interfaceFilterRegistration- Parameters:
dispatcherTypes- the dispatcher types of the filter mapping, or null if the default DispatcherType.REQUEST is to be usedisMatchAfter- true if the given filter mapping should be matched after any declared filter mappings, and false if it is supposed to be matched before any declared filter mappings of the ServletContext from which this FilterRegistration was obtainedurlPatterns- the url patterns of the filter mapping
-
getUrlPatternMappings
Description copied from interface:FilterRegistrationGets 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 interfaceFilterRegistration- Returns:
- a (possibly empty)
Collectionof the currently available URL pattern mappings of the Filter represented by thisFilterRegistration
-
getName
Description copied from interface:RegistrationGets the name of the Servlet or Filter that is represented by this Registration.- Specified by:
getNamein interfaceRegistration- Returns:
- the name of the Servlet or Filter that is represented by this Registration
-
getClassName
Description copied from interface:RegistrationGets the fully qualified class name of the Servlet or Filter that is represented by this Registration.- Specified by:
getClassNamein interfaceRegistration- Returns:
- the fully qualified class name of the Servlet or Filter that is represented by this Registration, or null if this Registration is preliminary
-
setInitParameter
Description copied from interface:RegistrationSets the initialization parameter with the given name and value on the Servlet or Filter that is represented by this Registration.- Specified by:
setInitParameterin interfaceRegistration- Parameters:
name- the initialization parameter namevalue- the initialization parameter value- Returns:
- 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
-
getInitParameter
Description copied from interface:RegistrationGets 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.- Specified by:
getInitParameterin interfaceRegistration- Parameters:
name- the name of the initialization parameter whose value is requested- Returns:
- the value of the initialization parameter with the given name, or null if no initialization parameter with the given name exists
-
setInitParameters
Description copied from interface:RegistrationSets 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
Registration.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
Registrationobject, so changes in the returned set are not reflected in theRegistrationobject, and vice-versa.- Specified by:
setInitParametersin interfaceRegistration- Parameters:
initParameters- the initialization parameters- Returns:
- the (possibly empty) Set of initialization parameter names that are in conflict
-
getInitParameters
Description copied from interface:RegistrationGets 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.- Specified by:
getInitParametersin interfaceRegistration- Returns:
- Map containing the currently available initialization parameters that will be used to initialize the Servlet or Filter represented by this Registration object
-
setAsyncSupported
public void setAsyncSupported(boolean isAsyncSupported) Description copied from interface:Registration.DynamicConfigures 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.
- Specified by:
setAsyncSupportedin interfaceRegistration.Dynamic- Parameters:
isAsyncSupported- true if the Servlet or Filter represented by this dynamic Registration supports asynchronous operations, false otherwise
-