Class DebugHandler

All Implemented Interfaces:
EventListener, Handler, HandlerContainer, Connection.Listener, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

public class DebugHandler extends HandlerWrapper implements Connection.Listener
Debug Handler. A lightweight debug handler that can be used in production code. Details of the request and response are written to an output stream and the current thread name is updated with information that will link to the details in that output.
  • Constructor Details

    • DebugHandler

      public DebugHandler()
  • Method Details

    • handle

      public void handle(String target, Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
      Description copied from interface: Handler
      Handle a request.
      Specified by:
      handle in interface Handler
      Overrides:
      handle in class HandlerWrapper
      Parameters:
      target - The target of the request - either a URI or a name.
      baseRequest - The original unwrapped request object.
      request - The request either as the Request object or a wrapper of that request.
      response - The response as the Response object or a wrapper of that request.
      Throws:
      IOException - if unable to handle the request or response processing
      javax.servlet.ServletException - if unable to handle the request or response due to underlying servlet issue
    • doStart

      protected void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      Overrides:
      doStart in class AbstractHandler
      Throws:
      Exception - If there was a problem starting. Will cause a transition to FAILED state
    • doStop

      protected void doStop() throws Exception
      Description copied from class: ContainerLifeCycle
      Stops the managed lifecycle beans in the reverse order they were added.
      Overrides:
      doStop in class AbstractHandler
      Throws:
      Exception - If there was a problem stopping. Will cause a transition to FAILED state
    • getOutputStream

      public OutputStream getOutputStream()
      Get the out.
      Returns:
      the out
    • setOutputStream

      public void setOutputStream(OutputStream out)
      Set the out to set.
      Parameters:
      out - the out to set
    • onOpened

      public void onOpened(Connection connection)
      Specified by:
      onOpened in interface Connection.Listener
    • onClosed

      public void onClosed(Connection connection)
      Specified by:
      onClosed in interface Connection.Listener