|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IErrorResponseFormatter
IErrorResponseFormatter is the interface for
formatting an ErrorResponse. A custom IErrorResponseFormatter
can
be written by extending this interface, and then registering the formatter through
a Struts plugin. The formatter will use the ErrorResponseInfo object to obtain
the error information, and then write the information to the response object.
A simple formatter may just print out the message in red.
public void formatError(ErrorResponseInfo errorInfo, PrintWriter outWriter)
{
outWriter.println("<h2 color=\"red\">");
outWriter.println("Error Info from ExampleResponseFormatter");
outWriter.println("</h2>");
outWriter.println("<h3>");
outWriter.print(errorInfo.getErrorCode());
if(errorInfo.getErrorText() != null)
{
outWriter.print(' ');
outWriter.print(errorInfo.getErrorText());
}
outWriter.println(" ");
outWriter.println("</h3>");
}
See the samples for an example of how to create a custom formatter.
Method Summary | |
---|---|
void |
formatError(ErrorResponseInfo errorInfo,
PortletRequest request,
PortletResponse response,
ViewCommandExecutionContext executionContext)
Format the error information, using all the execution information available. |
void |
formatError(ErrorResponseInfo errorInfo,
java.io.PrintWriter outWriter)
Format the error information en the request and response objects |
Method Detail |
---|
void formatError(ErrorResponseInfo errorInfo, PortletRequest request, PortletResponse response, ViewCommandExecutionContext executionContext)
errorInfo
- the ErrorResponseInfo objectrequest
- The request objectresponse
- The response objectexecutionContext
- the execution context objectvoid formatError(ErrorResponseInfo errorInfo, java.io.PrintWriter outWriter)
errorInfo
- the ErrorResponseInfo objectoutWriter
- the PrintWriter to write to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |