org.apache.catalina.servlet4preview

## Class GenericFilter

- java.lang.Object
- - org.apache.catalina.servlet4preview.GenericFilter

- All Implemented Interfaces:
    Serializable, Filter, FilterConfig
  Direct Known Subclasses:
    HttpFilter

      public abstract class GenericFilter
      extends Object
      implements Filter, FilterConfig, Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericFilter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FilterConfig` | `getFilterConfig()` Obtain the FilterConfig used to initialise this Filter instance.
    `String` | `getFilterName()` Get the name of the filter.
    `String` | `getInitParameter(String name)` Returns a `String` containing the value of the named initialization parameter, or `null` if the parameter does not exist.
    `Enumeration<String>` | `getInitParameterNames()` Returns the names of the filter's initialization parameters as an `Enumeration` of `String` objects, or an empty `Enumeration` if the filter has no initialization parameters.
    `ServletContext` | `getServletContext()` Returns a reference to the `ServletContext` in which the caller is executing.
    `void` | `init()` Convenience method for sub-classes to save them having to call `super.init(config)`.
    `void` | `init(FilterConfig filterConfig)` Called by the web container to indicate to a filter that it is being placed into service.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.servlet.Filter

      `destroy, doFilter`

- - ### Constructor Detail

    - #### GenericFilter

          public GenericFilter()

  - ### Method Detail

    - #### getInitParameter

          public String getInitParameter(String name)

      Description copied from interface: `javax.servlet.FilterConfig`
      Returns a `String` containing the value of the named initialization parameter, or `null` if the parameter does not exist.
      Specified by:
        `getInitParameter` in interface `FilterConfig`
      Parameters:
        `name` - `String` specifying the name of the initialization parameter
      Returns:
        `String` containing the value of the initialization parameter

    - #### getInitParameterNames

          public Enumeration<String> getInitParameterNames()

      Description copied from interface: `javax.servlet.FilterConfig`
      Returns the names of the filter's initialization parameters as an `Enumeration` of `String` objects, or an empty `Enumeration` if the filter has no initialization parameters.
      Specified by:
        `getInitParameterNames` in interface `FilterConfig`
      Returns:
        `Enumeration` of `String` objects containing the names of the filter's initialization parameters

    - #### getFilterConfig

          public FilterConfig getFilterConfig()

      Obtain the FilterConfig used to initialise this Filter instance.
      Returns:
        The config previously passed to the `init(FilterConfig)` method

    - #### getServletContext

          public ServletContext getServletContext()

      Description copied from interface: `javax.servlet.FilterConfig`
      Returns a reference to the `ServletContext` in which the caller is executing.
      Specified by:
        `getServletContext` in interface `FilterConfig`
      Returns:
        `ServletContext` object, used by the caller to interact with its servlet container
      See Also:
        `ServletContext`

    - #### init

          public void init(FilterConfig filterConfig)
                    throws ServletException

      Description copied from interface: `javax.servlet.Filter`
      Called by the web container to indicate to a filter that it is being placed into service. The servlet container calls the init method exactly once after instantiating the filter. The init method must complete successfully before the filter is asked to do any filtering work.

      The web container cannot place the filter into service if the init method either:

      - Throws a ServletException
      - Does not return within a time period defined by the web container
      Specified by:
        `init` in interface `Filter`
      Parameters:
        `filterConfig` - The configuration information associated with the filter instance being initialised
      Throws:
        `ServletException` - if the initialisation fails

    - #### init

          public void init()
                    throws ServletException

      Convenience method for sub-classes to save them having to call `super.init(config)`. This is a NO-OP by default.
      Throws:
        `ServletException` - If an exception occurs that interrupts the Filter's normal operation

    - #### getFilterName

          public String getFilterName()

      Description copied from interface: `javax.servlet.FilterConfig`
      Get the name of the filter.
      Specified by:
        `getFilterName` in interface `FilterConfig`
      Returns:
        The filter-name of this filter as defined in the deployment descriptor.

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.