Package com.google.gwt.jsonp.client
Class JsonpRequest<T>
java.lang.Object
com.google.gwt.jsonp.client.JsonpRequest<T>
- Type Parameters:
T
- the type of the response object.
A JSONP request that is waiting for a response. The request can be canceled.
-
Constructor Summary
ConstructorDescriptionJsonpRequest
(AsyncCallback<T> callback, int timeout, boolean expectInteger, String callbackParam, String failureCallbackParam) Create a new JSONP request.JsonpRequest
(AsyncCallback<T> callback, int timeout, boolean expectInteger, String callbackParam, String failureCallbackParam, String id) Create a new JSONP request with a hardcoded id. -
Method Summary
-
Constructor Details
-
JsonpRequest
JsonpRequest(AsyncCallback<T> callback, int timeout, boolean expectInteger, String callbackParam, String failureCallbackParam) Create a new JSONP request.- Parameters:
callback
- The callback instance to notify when the response comes backtimeout
- Time in ms after which aTimeoutException
will be thrownexpectInteger
- Should be true if T isInteger
, false otherwisecallbackParam
- Name of the url param of the callback function namefailureCallbackParam
- Name of the url param containing the failure callback function name, or null for no failure callback
-
JsonpRequest
JsonpRequest(AsyncCallback<T> callback, int timeout, boolean expectInteger, String callbackParam, String failureCallbackParam, String id) Create a new JSONP request with a hardcoded id. This could be used to manually control which resources are considered duplicates (by giving them identical ids). Could also be used if the callback name needs to be completely user controlled (since the id is part of the callback name).- Parameters:
callback
- The callback instance to notify when the response comes backtimeout
- Time in ms after which aTimeoutException
will be thrownexpectInteger
- Should be true if T isInteger
, false otherwisecallbackParam
- Name of the url param of the callback function namefailureCallbackParam
- Name of the url param containing the failure callback function name, or null for no failure callbackid
- unique id for the resource that is being fetched
-
-
Method Details
-
cancel
public void cancel()Cancels a pending request. Note that if you are using preset ID's, this will not work, since there is no way of knowing if there are other requests pending (or have already returned) for the same data. -
getCallback
-
getTimeout
public int getTimeout() -
toString
-
getCallbackId
String getCallbackId() -
send
Sends a request using the JSONP mechanism.- Parameters:
baseUri
- To be sent to the server.
-