Class RequestDumperValve

  • All Implemented Interfaces:
    Contained, Lifecycle, Valve, GlassFishValve

    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.

    Version:
    $Revision: 1.3 $ $Date: 2005/12/08 01:28:25 $
    Author:
    Craig R. McClanahan
    • Constructor Detail

      • RequestDumperValve

        public RequestDumperValve()
    • Method Detail

      • invoke

        public int invoke​(Request request,
                          Response response)
                   throws IOException,
                          jakarta.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 GlassFishValve
        Specified by:
        invoke in class ValveBase
        Parameters:
        request - The servlet request to be processed
        response - The servlet response to be created
        Returns:
        INVOKE_NEXT or END_PIPELINE
        Throws:
        IOException - if an input/output error occurs
        jakarta.servlet.ServletException - if a servlet error occurs
      • postInvoke

        public void postInvoke​(Request request,
                               Response response)
                        throws IOException,
                               jakarta.servlet.ServletException
        Log the interesting response parameters.
        Specified by:
        postInvoke in interface GlassFishValve
        Overrides:
        postInvoke in class ValveBase
        Parameters:
        request - The servlet request to be processed
        response - The servlet response to be created
        Throws:
        IOException - if an input/output error occurs
        jakarta.servlet.ServletException - if a servlet error occurs
      • toString

        public String toString()
        Return a String rendering of this object.
        Overrides:
        toString in class Object
      • log

        protected void log​(String message)
        Log a message on the Logger associated with our Container (if any).
        Parameters:
        message - Message to be logged
      • log

        protected void log​(String message,
                           Throwable t)
        Log a message on the Logger associated with our Container (if any).
        Parameters:
        message - Message to be logged
        t - Associated exception