Package org.apache.catalina.filters
Class RequestDumperFilter
java.lang.Object
org.apache.catalina.filters.RequestDumperFilter
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Called by the web container to indicate to a filter that it is being taken out of service.void
doFilter
(ServletRequest request, ServletResponse response, FilterChain chain) Log the interesting request parameters, invoke the next Filter in the sequence, and log the interesting response parameters.void
init
(FilterConfig filterConfig) Called by the web container to indicate to a filter that it is being placed into service.
-
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 interfaceFilter
- Parameters:
request
- The servlet request to be processedresponse
- The servlet response to be createdchain
- The filter chain being processed- Throws:
IOException
- if an input/output error occursServletException
- if a servlet error occurs
-
init
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 interfaceFilter
- 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.
-