|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.maryanovsky.gwtutils.client.AbstractResponseHandler
com.maryanovsky.gwtutils.client.XmlResponseHandler
public class XmlResponseHandler
A base implementation of a RequestCallback which handles XML
responses.
| Field Summary |
|---|
| Fields inherited from class com.maryanovsky.gwtutils.client.AbstractResponseHandler |
|---|
requestUrl |
| Constructor Summary | |
|---|---|
XmlResponseHandler(String requestUrl,
String successfulResponseTagName,
String errorResponseTagName)
Creates a new XmlResponseHandler with the specified arguments. |
|
XmlResponseHandler(String requestUrl,
String successfulResponseTagName,
String errorResponseTagName,
XmlParser parser,
ResultCallback callback)
Creates a new XmlResponseHandler with the specified arguments. |
|
| Method Summary | |
|---|---|
protected String |
getRequestUrl()
Returns the request URL. |
protected void |
onAnyResponse()
Invoked whenever any kind of response arrives, before any of the other methods. |
protected void |
onBadlyFormedXml(Response response,
DOMException e)
Invoked when the result could not be parsed as an XML document. |
protected void |
onBadResponse(Document document,
ParseException e)
Invoked when the received response cannot be parsed by parseResponse(Document). |
protected void |
onErrorXmlResponse(Document document)
Invoked when an error response arrives. |
protected void |
onResult(Object result)
Invoked when a response successfully parsed by parseResponse(Document) arrives. |
protected void |
onSuccessfulResponse(Response response)
Invoked when a successful response arrives. |
protected void |
onSuccessfulXmlResponse(Document document)
Invoked when a successful XML response arrives. |
protected void |
onUnrecognizedResponse(Document document)
Invoked when an unknown response arrives (a document whose main tag name is not recognized). |
protected Object |
parseResponse(Document document)
Parses the specified response and returns the resulting object. |
protected void |
showErrorMessage(String errorMessage)
Displays the specified error message. |
| Methods inherited from class com.maryanovsky.gwtutils.client.AbstractResponseHandler |
|---|
onError, onRequestError, onResponseReceived, onUnexpectedStatusCode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlResponseHandler(String requestUrl,
String successfulResponseTagName,
String errorResponseTagName,
XmlParser parser,
ResultCallback callback)
XmlResponseHandler with the specified arguments.
requestUrl - The URL of the request.successfulResponseTagName - The name of the document's main tag in
case of a successful response.errorResponseTagName - The name of the document's main tag in case
of an error response.parser - The parser we use to parse the response XML document; may
be null.callback - The callback to notify when a response/result arrives;
may be null.
public XmlResponseHandler(String requestUrl,
String successfulResponseTagName,
String errorResponseTagName)
XmlResponseHandler with the specified arguments.
requestUrl - The URL of the request.successfulResponseTagName - The name of the document's main tag in
case of a successful response.errorResponseTagName - The name of the document's main tag in case
of an error response.| Method Detail |
|---|
protected String getRequestUrl()
protected void onSuccessfulResponse(Response response)
onSuccessfulXmlResponse(Document),
onErrorXmlResponse(Document) or
onUnrecognizedResponse(Document) depending on the root tag name
of the response document. If the response could not be parsed as an XML
document, invoked onBadlyFormedXml(Response, DOMException).
onSuccessfulResponse in class AbstractResponseHandler
protected void onBadlyFormedXml(Response response,
DOMException e)
protected Object parseResponse(Document document)
throws ParseException
ParseException. The default
implementation returns uses the parser passed to the constructor to
parse the response. If the parser is null, returns the
document itself.
ParseExceptionprotected void onSuccessfulXmlResponse(Document document)
onResult(Object).
protected void onErrorXmlResponse(Document document)
protected void onUnrecognizedResponse(Document document)
protected void onBadResponse(Document document,
ParseException e)
parseResponse(Document). The default implementation shows an
error message.
document - The response document.e - The exception thrown when parsing the response.protected void onAnyResponse()
ResultCallback.requestFinished() on the callback, if any.
onAnyResponse in class AbstractResponseHandlerprotected void onResult(Object result)
parseResponse(Document) arrives. The default implementation
invokes ResultCallback.resultReceived(Object) on the callback, if
any.
result - The object returned by parseResponse(Document).protected void showErrorMessage(String errorMessage)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||