Package org.apache.catalina.filters
Class RequestDumperFilter
- java.lang.Object
-
- org.apache.catalina.filters.RequestDumperFilter
-
- All Implemented Interfaces:
Filter
public class RequestDumperFilter extends java.lang.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.RequestDumperFilterlogger is directed to a dedicated file and that theorg.apache.juli.VerbatimFormatteris used.- Author:
- Craig R. McClanahan
-
-
Constructor Summary
Constructors Constructor Description RequestDumperFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Called by the web container to indicate to a filter that it is being taken out of service.voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain)Log the interesting request parameters, invoke the next Filter in the sequence, and log the interesting response parameters.voidinit(FilterConfig filterConfig)Called by the web container to indicate to a filter that it is being placed into service.
-
-
-
Method Detail
-
doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException
Log the interesting request parameters, invoke the next Filter in the sequence, and log the interesting response parameters.- Specified by:
doFilterin interfaceFilter- Parameters:
request- The servlet request to be processedresponse- The servlet response to be createdchain- The filter chain being processed- Throws:
java.io.IOException- if an input/output error occursServletException- if a servlet error occurs
-
init
public void init(FilterConfig filterConfig) throws ServletException
Description copied from interface:javax.servlet.FilterCalled 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:
initin 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.FilterCalled 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.
-
-