java.lang.Object
com.amazonaws.serverless.proxy.internal.servlet.FilterHolder

public class FilterHolder extends Object
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.
  • 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 name
      newFilter - The filter object to be registered against the name
      context - The ServletContext this object was initialized by
  • Method Details

    • init

      public void init() throws jakarta.servlet.ServletException
      Initializes the wrapped filter and sets the isFilterInitialized property to true. This should be called before invoking a filter if the result of the isFilterInitialized() 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 the init method.
      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 default Config object implemented in this file
      Returns:
      The filter config object
    • getRegistration

      public FilterHolder.Registration getRegistration()
      Returns the Registration object for the filter. The Registration object defined in this file implements both FilterRegistration and FilterRegistration.Dynamic
      Returns:
      The registration object
    • getFilterName

      public String getFilterName()
      The name associated with the filter
      Returns:
      The name for the filter
    • setFilterName

      public void setFilterName(String filterName)
    • getInitParameters

      public Map<String,String> 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()