|
Spiffy UI Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RESTCallback
This interface is used when calling REST APIs in conjunction with RESTility.
RESTCallback is the low level interface for handling JSON and HTTP. This interface gets access to errors generated by the HTTP call and the raw JSON values the REST call returns. This interface is typically used in conjunction with a RESTObjectCallBack. The RESTCallback handles converting the JSON data structure into an object and then returns those data structures to the RESTObjectCallBack.
RESTObjectCallBack
,
RESTility
Method Summary | |
---|---|
void |
onError(int statusCode,
java.lang.String errorResponse)
Called if there is an unexpected error calling the REST API. |
void |
onError(RESTException e)
Called if the REST endpoint returns a valid response with an error message following in the SOAP error format encoded in JSON. |
void |
onSuccess(JSONValue val)
Called when the REST call completes successfully. |
Method Detail |
---|
void onSuccess(JSONValue val)
Called when the REST call completes successfully.
A successful REST request is one that returned a value from the server containing well formed JSON which did not contain an NCAC error message or an authentication request. Successful REST requests may return any HTTP response code and are not limited to 200.
val
- The JSON value from the REST callvoid onError(int statusCode, java.lang.String errorResponse)
Called if there is an unexpected error calling the REST API.
This method is called for unexpected errors including network failures, data loss, and server responses which aren't well formed JSON.
statusCode
- the HTTP status code with the errorerrorResponse
- the error message response from the REST endpointvoid onError(RESTException e)
Called if the REST endpoint returns a valid response with an error message following in the SOAP error format encoded in JSON.
REST calls in this framework have built-in error handling to parse a strict format of error message in JSON and represent it as a Java object. These message represente well know errors and are often part of the public API for a REST interface.
These error messages follow a JSON format of the standard SOAP error message. The basic structure looks like this:
{ "Fault": { "Code": { "Value": "Sender", "Subcode": { "Value": "MessageTimeout" } }, "Reason": { "Text": "Sender Timeout" }, "Detail": { "MaxTime": "P5M" } } }
The detail section is reserved for additional properties of the specific error message.
e
- the RESTException
|
Spiffy UI Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |