org.apache.catalina.valves
Class RequestDumperValve

java.lang.Object
  extended byorg.apache.catalina.valves.ValveBase
      extended byorg.apache.catalina.valves.RequestDumperValve
All Implemented Interfaces:
Contained, javax.management.MBeanRegistration, Valve

public class RequestDumperValve
extends ValveBase

Implementation of a Valve 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.

This Valve may be attached to any Container, depending on the granularity of the logging you wish to perform.

Note that this Valve sets the character encoding of the request to the default (ISO-8859-1) if it's the first thing invoking request.getParameterNames, which is usually the case. If you're running in an environment where this encoding is problematic, consider using another debugging approach such as a Filter that reproduces this Valve's functionality.

For a similar mechanism that is portable to all Servlet 2.4 containers, check out the "RequestDumperFilter" Filter in the example application (the source for this filter may be found in $CATALINA_HOME/webapps/examples/WEB-INF/classes/filters.

Version:
$Id: RequestDumperValve.java 939526 2010-04-30 00:39:28Z kkolinko $
Author:
Craig R. McClanahan

Field Summary
protected static StringManager sm
          The StringManager for this package.
 
Fields inherited from class org.apache.catalina.valves.ValveBase
container, containerLog, controller, domain, mserver, next, oname
 
Constructor Summary
RequestDumperValve()
           
 
Method Summary
 java.lang.String getInfo()
          Return descriptive information about this Valve implementation.
 void invoke(Request request, Response response)
          Log the interesting request parameters, invoke the next Valve in the sequence, and log the interesting response parameters.
 java.lang.String toString()
          Return a String rendering of this object.
 
Methods inherited from class org.apache.catalina.valves.ValveBase
backgroundProcess, createObjectName, getContainer, getContainerName, getController, getDomain, getNext, getObjectName, getParentName, postDeregister, postRegister, preDeregister, preRegister, setContainer, setController, setNext, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sm

protected static StringManager sm
The StringManager for this package.

Constructor Detail

RequestDumperValve

public RequestDumperValve()
Method Detail

getInfo

public java.lang.String getInfo()
Return descriptive information about this Valve implementation.

Specified by:
getInfo in interface Valve
Overrides:
getInfo in class ValveBase

invoke

public void invoke(Request request,
                   Response response)
            throws java.io.IOException,
                   javax.servlet.ServletException
Log the interesting request parameters, invoke the next Valve in the sequence, and log the interesting response parameters.

Specified by:
invoke in interface Valve
Specified by:
invoke in class ValveBase
Parameters:
request - The servlet request to be processed
response - The servlet response to be created
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet error occurs

toString

public java.lang.String toString()
Return a String rendering of this object.

Overrides:
toString in class ValveBase


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