Class JsonpRequest<T>

java.lang.Object
com.google.gwt.jsonp.client.JsonpRequest<T>
Type Parameters:
T - the type of the response object.

public class JsonpRequest<T> extends Object
A JSONP request that is waiting for a response. The request can be canceled.
  • 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 back
      timeout - Time in ms after which a TimeoutException will be thrown
      expectInteger - Should be true if T is Integer, false otherwise
      callbackParam - Name of the url param of the callback function name
      failureCallbackParam - 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 back
      timeout - Time in ms after which a TimeoutException will be thrown
      expectInteger - Should be true if T is Integer, false otherwise
      callbackParam - Name of the url param of the callback function name
      failureCallbackParam - Name of the url param containing the failure callback function name, or null for no failure callback
      id - 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

      public AsyncCallback<T> getCallback()
    • getTimeout

      public int getTimeout()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCallbackId

      String getCallbackId()
    • send

      void send(String baseUri)
      Sends a request using the JSONP mechanism.
      Parameters:
      baseUri - To be sent to the server.