|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.net.AbstractResponseHandler
public abstract class AbstractResponseHandler
A base implementation of a RequestCallback
.
Field Summary | |
---|---|
protected String |
requestUrl
The URL of the request. |
Constructor Summary | |
---|---|
AbstractResponseHandler(String requestUrl)
Creates a new AbstractResponseHandler with the specified URL of
the request. |
Method Summary | |
---|---|
protected void |
onAnyResponse()
Invoked whenever any kind of response arrives, before any of the other methods. |
void |
onError(Request request,
Throwable exception)
Invokes onAnyResponse() and then
onRequestError(Request, Throwable) . |
protected void |
onRequestError(Request request,
Throwable exception)
Invoked when an error occurs during the request. |
void |
onResponseReceived(Request request,
Response response)
If the response code is 200, parses the response and passes the result to onSuccessfulResponse(Response) . |
protected abstract void |
onSuccessfulResponse(Response response)
Invoked when a successful response has arrived. |
protected void |
onUnexpectedStatusCode(Request request,
Response response)
Invoked when the HTTP response code is not 200. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final String requestUrl
Constructor Detail |
---|
public AbstractResponseHandler(String requestUrl)
AbstractResponseHandler
with the specified URL of
the request.
Method Detail |
---|
public final void onError(Request request, Throwable exception)
onAnyResponse()
and then
onRequestError(Request, Throwable)
.
onError
in interface RequestCallback
public void onResponseReceived(Request request, Response response)
onSuccessfulResponse(Response)
. If the response code is not
200, invokes onUnexpectedStatusCode(Request, Response)
.
onResponseReceived
in interface RequestCallback
protected abstract void onSuccessfulResponse(Response response)
protected void onRequestError(Request request, Throwable exception)
request
- The request during which the error occurred.exception
- The error that occurred.protected void onUnexpectedStatusCode(Request request, Response response)
request
- The request that was sent to the server.response
- The response received from the server.protected void onAnyResponse()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |