GWT 2.7.0

com.google.gwt.jsonp.client
Class JsonpRequest<T>

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

public class JsonpRequest<T>
extends java.lang.Object

A JSONP request that is waiting for a response. The request can be canceled.


Constructor Summary
JsonpRequest(AsyncCallback<T> callback, int timeout, boolean expectInteger, java.lang.String callbackParam, java.lang.String failureCallbackParam)
          Create a new JSONP request.
JsonpRequest(AsyncCallback<T> callback, int timeout, boolean expectInteger, java.lang.String callbackParam, java.lang.String failureCallbackParam, java.lang.String id)
          Create a new JSONP request with a hardcoded id.
 
Method Summary
 void cancel()
          Cancels a pending request.
 AsyncCallback<T> getCallback()
           
(package private)  java.lang.String getCallbackId()
           
 int getTimeout()
           
(package private)  void send(java.lang.String baseUri)
          Sends a request using the JSONP mechanism.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsonpRequest

JsonpRequest(AsyncCallback<T> callback,
             int timeout,
             boolean expectInteger,
             java.lang.String callbackParam,
             java.lang.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,
             java.lang.String callbackParam,
             java.lang.String failureCallbackParam,
             java.lang.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 Detail

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 java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCallbackId

java.lang.String getCallbackId()

send

void send(java.lang.String baseUri)
Sends a request using the JSONP mechanism.

Parameters:
baseUri - To be sent to the server.

GWT 2.7.0