public class ErrorReportValve extends ValveBase
Implementation of a Valve that outputs HTML error pages.
This Valve should be attached at the Host level, although it will work if attached to a Context.
HTML code from the Cocoon 2 project.
Modifier and Type | Field and Description |
---|---|
protected static StringManager |
sm
The StringManager for this package.
|
container, controller, 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 |
---|
ErrorReportValve() |
Modifier and Type | Method and Description |
---|---|
String |
getInfo()
Return descriptive information about this Valve implementation.
|
int |
invoke(Request request,
Response response)
Invoke the next Valve in the sequence.
|
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).
|
static String |
makeErrorPage(int statusCode,
String message,
Throwable throwable,
Throwable rootCause,
String report,
javax.servlet.http.HttpServletResponse response) |
void |
postInvoke(Request request,
Response response)
A post-request processing implementation that does nothing.
|
protected void |
report(Request request,
Response response,
Throwable throwable)
Prints out an error report.
|
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
protected static final StringManager sm
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
ValveBase
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 report(Request request, Response response, Throwable throwable) throws IOException
request
- The request being processedresponse
- The response being generatedthrowable
- The exception that occurred (which possibly wraps
a root cause exceptionIOException
protected void log(String message)
message
- Message to be loggedprotected void log(String message, Throwable t)
message
- Message to be loggedt
- Associated exceptionCopyright © 2020. All rights reserved.