com.google.gwt.gadgets.client.io
Class RequestOptions

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.gadgets.client.io.RequestOptions

public class RequestOptions
extends com.google.gwt.core.client.JavaScriptObject

A class defining request options used with GadgetsIo.makeRequest(java.lang.String, com.google.gwt.gadgets.client.io.ResponseReceivedHandler) methods.


Constructor Summary
protected RequestOptions()
           
 
Method Summary
static RequestOptions newInstance()
          Returns new instance of RequestOptions.
 RequestOptions setAuthorizationType(AuthorizationType authorizationType)
          Sets the authorization method.
 RequestOptions setContentType(ContentType contentType)
          Sets a type of content of the requested resource.
 RequestOptions setHeader(java.lang.String key, java.lang.String value)
          Sets HTTP headers to send to the URL.
 RequestOptions setMethodType(MethodType methodType)
          Sets the HTTP request method.
 RequestOptions setPostData(java.lang.String data)
          Specifies the data to send to the URL using the POST method; defaults to null.
 RequestOptions setRefreshInterval(int interval)
          Explicitly sets the lifespan of cached content.
 
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

RequestOptions

protected RequestOptions()
Method Detail

newInstance

public static RequestOptions newInstance()
Returns new instance of RequestOptions.

Returns:
new instance of RequestOptions.

setAuthorizationType

public final RequestOptions setAuthorizationType(AuthorizationType authorizationType)
Sets the authorization method. Consult specification for details.

Parameters:
authorizationType - the authorization method.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.

setContentType

public final RequestOptions setContentType(ContentType contentType)
Sets a type of content of the requested resource. This influences the method of parsing used for received data.

Parameters:
contentType - type of content of the requested resource.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.

setHeader

public final RequestOptions setHeader(java.lang.String key,
                                      java.lang.String value)
Sets HTTP headers to send to the URL.

Parameters:
key - Name of the header.
value - Value for the header.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.

setMethodType

public final RequestOptions setMethodType(MethodType methodType)
Sets the HTTP request method. Note that the only request method required by container to implement is MethodType.GET method. Implementation of remaining methods is optional.

Parameters:
methodType - the HTTP request method.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.

setPostData

public final RequestOptions setPostData(java.lang.String data)
Specifies the data to send to the URL using the POST method; defaults to null.

Parameters:
data - the data to send.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.

setRefreshInterval

public final RequestOptions setRefreshInterval(int interval)
Explicitly sets the lifespan of cached content. The Refresh Interval is the number of seconds the container should cache the given response. By default, the HTTP caching headers will be respected for fetched content. If the refresh interval is set, this value will take precedence over any HTTP cache headers. If this value is not set and there are no HTTP caching headers specified, this value will default to 3600 (one hour). Note that Signed requests and objects with POST_DATA present will generally not be cached.

Parameters:
interval - the lifespan of cached content in seconds.
Returns:
this instance of RequestOptions for convenience in using the builder pattern.