com.google.gwt.gadgets.client.io
Class Response<T>

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.gadgets.client.io.Response<T>
Type Parameters:
T - Type of parsed data of the response.

public class Response<T>
extends com.google.gwt.core.client.JavaScriptObject

A class wrapping the response returned by gadget container.


Constructor Summary
protected Response()
           
 
Method Summary
 T getData()
          Returns parsed data of the response, if applicable.
 com.google.gwt.core.client.JsArrayString getErrors()
          Returns an array of any errors that occurred when making the request.
 java.lang.String getHeader(java.lang.String header)
          Returns the response header.
 java.lang.String getOauthApprovalUrl()
          If this value is specified, the user needs to visit an external page to approve the gadget's request to access data.
 java.lang.String getOauthError()
          If this value is specified, it indicates an OAuth-related error occurred.
 java.lang.String getOauthErrorText()
          If this value is specified, it indicates an OAuth-related error occurred.
 int getStatusCode()
          Returns the status code of the response.
 java.lang.String getText()
          Returns unparsed data of the response.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

protected Response()
Method Detail

getData

public final T getData()
Returns parsed data of the response, if applicable. This will contain a different type of data depending on the type of request that was made. The raw response text is returned if the response could not be parsed. See gadgets.io.ContentType for information about what to expect in this field.

Returns:
parsed data of the response, if applicable.

getErrors

public final com.google.gwt.core.client.JsArrayString getErrors()
Returns an array of any errors that occurred when making the request.

Returns:
an array of any errors that occurred when making the request or null if absent.

getHeader

public final java.lang.String getHeader(java.lang.String header)
Returns the response header.

Parameters:
header - Header name.
Returns:
Response header or null if absent.

getOauthApprovalUrl

public final java.lang.String getOauthApprovalUrl()
If this value is specified, the user needs to visit an external page to approve the gadget's request to access data. Use of a pop-up window to direct the user to the external page is recommended. Once the user has approved access, the gadget can repeat the makeRequest call to retrieve the data.

Returns:
The URL of external page to visit or null if absent.

getOauthError

public final java.lang.String getOauthError()
If this value is specified, it indicates an OAuth-related error occurred. The value will be one of a set of string constants that can be used for programmatically detecting errors. The constants are undefined for opensocial-0.8, but implementers should attempt to agree on a set of useful constant values for standardization in opensocial-0.9.

Returns:
OAuth-related error constant or null if absent.

getOauthErrorText

public final java.lang.String getOauthErrorText()
If this value is specified, it indicates an OAuth-related error occurred. The value is free-form text that can be used to provide debugging information for gadget developers.

Returns:
Free form text describing OAuth-related error or null if absent.

getStatusCode

public final int getStatusCode()
Returns the status code of the response.

Returns:
the status code of the response.

getText

public final java.lang.String getText()
Returns unparsed data of the response.

Returns:
unparsed data of the response.