|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.ibm.wbi.Meg
|
+--com.ibm.wbi.Editor
|
+--com.ibm.wbi.protocol.http.beans.ErrorPageEditor
An Editor for producing an HTTP response that corresponds to an error condition. It is designed to work in conjunction with the ErrorPageException class. Typically, the programmer will write an Editor with a try block around code where an error condition could occur. When the error is detected, an ErrorPageException object is constructed and one of the following actions is taken: 1. the object is attached to the request event's (RequestInfo) transaction data. The response code in the header is modified to an appropriate value to indicate the error. This (the ErrorPageEditor is invoked by WBI to handle a request when the error code matches configured conditions. or 2. an ErrorPageEditor is constructed using the ErrorPageException and the response is forwarded to the editor for handling the error.
There are three properties that can be set: ResponseCode, ResponseText, and PageText. The ResponseCode is the HTTP code that will be in the HTTP response. The ResponseText is the short message that is part of the HTTP response. The PageText is the HTML that accompanies the HTTP response.
ErrorPageException| Field Summary | |
protected java.lang.String |
contentType
The content type |
static java.lang.String |
COPYRIGHT
IBM copyright information |
protected ErrorPageException |
m_EPE
|
protected java.lang.String |
pageText
The page text. |
| Fields inherited from class com.ibm.wbi.Meg |
EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED |
| Constructor Summary | |
ErrorPageEditor()
Construct an instance with a ResponseCode of 400, a ResponseText of "Unknown Error", and a PageText of "". |
|
ErrorPageEditor(RequestEvent re,
ErrorPageException e)
Construct an instance from the information in the ErrorPageException. |
|
ErrorPageEditor(SystemContext systemContext,
RequestEvent re,
ErrorPageException e)
Construct an instance from the information in the ErrorPageException. |
|
| Method Summary | |
int |
getContentLength(RequestEvent re)
Access the Content-Length property. |
protected java.lang.String |
getHeader(RequestEvent re)
|
java.lang.String |
getPageText()
Access the PageText property. |
int |
getResponseCode(RequestEvent re)
Access the ResponseCode property. |
int |
getType()
getType - required |
void |
handleRequest(RequestEvent requestEvent)
Called by WBI on incoming requests-- or called by direct invocation (via forward()): responsible for returning an error page based on response code |
void |
initialize()
Called by WBI (or some other environment) to let us know where to get our environmental configuration from (in case we need it). |
void |
setContentLength(RequestEvent re,
int len)
Set the Content-Length property. |
void |
setContentType(RequestEvent re,
java.lang.String ct)
Set the contentType property. |
void |
setPageText(java.lang.String pt)
Set the PageText property. |
void |
setResponseCode(RequestEvent re,
int rc)
Set the ResponseCode property. |
void |
setResponseText(RequestEvent re,
java.lang.String rt)
Set the ResponseText property. |
protected void |
writeContent(RequestEvent re)
Write the content to the output stream. |
| Methods inherited from class com.ibm.wbi.Meg |
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup |
| Field Detail |
public static final java.lang.String COPYRIGHT
protected java.lang.String pageText
protected java.lang.String contentType
protected ErrorPageException m_EPE
| Constructor Detail |
public ErrorPageEditor()
public ErrorPageEditor(RequestEvent re,
ErrorPageException e)
re - The Request Event being worked one - The exception which indicates the type and cause of the
error.
public ErrorPageEditor(SystemContext systemContext,
RequestEvent re,
ErrorPageException e)
re - The Request Event being worked one - The exception which indicates the type and cause of the
error.| Method Detail |
public void initialize()
initialize in class Megcom.ibm.wbi.MegMeg.getSystemContext()public void setPageText(java.lang.String pt)
pt - The HTML that will be passed back to the browser for
display.public java.lang.String getPageText()
public void setContentLength(RequestEvent re,
int len)
rc - The HTTP Content-Length that will be passed back to the
browserpublic int getContentLength(RequestEvent re)
public void setResponseCode(RequestEvent re,
int rc)
rc - The HTTP response code that will be passed back to the
browser (e.g. 200, meaning "Ok").public int getResponseCode(RequestEvent re)
public void setResponseText(RequestEvent re,
java.lang.String rt)
rt - The response text that accompanies the HTTP response
(e.g. "Ok").
public void setContentType(RequestEvent re,
java.lang.String ct)
ct - The HTTP content-type that will be passed back to the
browserprotected java.lang.String getHeader(RequestEvent re)
protected void writeContent(RequestEvent re)
throws java.io.IOException
e - The request event.java.io.IOException - If an error occurs.public int getType()
getType in class Editorcom.ibm.wbi.EditorMeg.EDITOR.
public void handleRequest(RequestEvent requestEvent)
throws RequestRejectedException,
java.io.IOException
handleRequest in class EditorrequestEvent - RequestEvent to process
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||