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.
container, controller, debug, domain, lifecycle, log, next, oname, rb, started
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, INIT_EVENT, START_EVENT, STOP_EVENT
END_PIPELINE, INVOKE_NEXT
Constructor and Description |
---|
RequestDumperValve() |
Modifier and Type | Method and Description |
---|---|
String |
getInfo()
Return descriptive information about this Valve implementation.
|
int |
invoke(Request request,
Response response)
Log the interesting request parameters, invoke the next Valve in the
sequence, and log the interesting response parameters.
|
protected void |
log(String message)
Log a message on the Logger associated with our Container (if any).
|
protected void |
log(String message,
Throwable t)
Log a message on the Logger associated with our Container (if any).
|
void |
postInvoke(Request request,
Response response)
Log the interesting response parameters.
|
String |
toString()
Return a String rendering of this object.
|
addLifecycleListener, backgroundProcess, createObjectName, event, findLifecycleListeners, getContainer, getController, getDebug, getDomain, getNext, getObjectName, getParentName, invoke, isStarted, removeLifecycleListener, setContainer, setController, setDebug, setNext, setObjectName, start, stop
public String getInfo()
public int invoke(Request request, Response response) throws IOException, javax.servlet.ServletException
invoke
in interface GlassFishValve
invoke
in class ValveBase
request
- The servlet request to be processedresponse
- The servlet response to be createdINVOKE_NEXT
or END_PIPELINE
IOException
- if an input/output error occursjavax.servlet.ServletException
- if a servlet error occurspublic void postInvoke(Request request, Response response) throws IOException, javax.servlet.ServletException
postInvoke
in interface GlassFishValve
postInvoke
in class ValveBase
request
- The servlet request to be processedresponse
- The servlet response to be createdIOException
- if an input/output error occursjavax.servlet.ServletException
- if a servlet error occurspublic String toString()
protected void log(String message)
message
- Message to be loggedCopyright © 2021. All rights reserved.