Class RequestDumperFilter

java.lang.Object
org.apache.catalina.filters.RequestDumperFilter
All Implemented Interfaces:
Filter

public class RequestDumperFilter extends Object implements Filter

Implementation of a Filter that logs interesting contents from the specified Request (before processing) and the corresponding Response (after processing). It is especially useful in debugging problems related to headers and cookies.

When using this Filter, it is strongly recommended that the org.apache.catalina.filter.RequestDumperFilter logger is directed to a dedicated file and that the org.apache.juli.VerbatimFormatter is used.

Author:
Craig R. McClanahan
  • Constructor Details

    • RequestDumperFilter

      public RequestDumperFilter()
  • Method Details

    • doFilter

      public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
      Log the interesting request parameters, invoke the next Filter in the sequence, and log the interesting response parameters.
      Specified by:
      doFilter in interface Filter
      Parameters:
      request - The servlet request to be processed
      response - The servlet response to be created
      chain - The filter chain being processed
      Throws:
      IOException - if an input/output error occurs
      ServletException - if a servlet error occurs
    • 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
    • destroy

      public void destroy()
      Description copied from interface: javax.servlet.Filter
      Called by the web container to indicate to a filter that it is being taken out of service. This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the web container calls this method, it will not call the doFilter method again on this instance of the filter.

      This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.
      Specified by:
      destroy in interface Filter