Class FilterHolder
java.lang.Object
com.amazonaws.serverless.proxy.internal.servlet.FilterHolder
Wrapper for a servlet filter object. This object includes the filter itself, the filter name, the initialization
parameters, as well as the registration object with its mappings. Filter holders are stored in the
AwsServletContext
object and are used by the by the FilterChainHandler object to process a request.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classRegistration class for the filter. -
Constructor Summary
ConstructorsConstructorDescriptionFilterHolder(jakarta.servlet.Filter newFilter, jakarta.servlet.ServletContext context) FilterHolder(String name, jakarta.servlet.Filter newFilter, jakarta.servlet.ServletContext context) Creates a new filter holder for the given Filter object. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.servlet.FilterReturns the filter objectjakarta.servlet.FilterConfigThe filter config object implementation.The name associated with the filterThe map of initialization parameters passed to the filterReturns the Registration object for the filter.jakarta.servlet.ServletContextThe servlet context that initialized the filtervoidinit()Initializes the wrapped filter and sets theisFilterInitializedproperty to true.booleanbooleanChecks whether the filter this holder is responsible for has been initialized.voidsetFilterName(String filterName)
-
Constructor Details
-
FilterHolder
public FilterHolder(jakarta.servlet.Filter newFilter, jakarta.servlet.ServletContext context) -
FilterHolder
public FilterHolder(String name, jakarta.servlet.Filter newFilter, jakarta.servlet.ServletContext context) Creates a new filter holder for the given Filter object. The object is initialized with an empty map of parameters and a registration with no mappings- Parameters:
name- The filter namenewFilter- The filter object to be registered against the namecontext- The ServletContext this object was initialized by
-
-
Method Details
-
init
public void init() throws jakarta.servlet.ServletExceptionInitializes the wrapped filter and sets theisFilterInitializedproperty to true. This should be called before invoking a filter if the result of theisFilterInitialized()method is false.- Throws:
jakarta.servlet.ServletException- Propagates any servlet exception thrown by the filter initialization
-
isFilterInitialized
public boolean isFilterInitialized()Checks whether the filter this holder is responsible for has been initialized. This method should be checked before calling a filter, if it returns false then you should call theinitmethod.- Returns:
- True if the filter has been initialized before, false otherwise
-
getFilter
public jakarta.servlet.Filter getFilter()Returns the filter object- Returns:
- the filter object
-
getFilterConfig
public jakarta.servlet.FilterConfig getFilterConfig()The filter config object implementation. This is the defaultConfigobject implemented in this file- Returns:
- The filter config object
-
getRegistration
Returns the Registration object for the filter. TheRegistrationobject defined in this file implements bothFilterRegistrationandFilterRegistration.Dynamic- Returns:
- The registration object
-
getFilterName
The name associated with the filter- Returns:
- The name for the filter
-
setFilterName
-
getInitParameters
The map of initialization parameters passed to the filter- Returns:
- The Map of initialization parameters used for the filter
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()The servlet context that initialized the filter- Returns:
- The servlet context the filter was initialized on
-
isAnnotated
public boolean isAnnotated()
-