public class

RpcRequestBuilder

extends Object
java.lang.Object
   ↳ com.google.gwt.user.client.rpc.RpcRequestBuilder

Class Overview

This class encapsulates the logic necessary to configure a RequestBuilder for use with an RPC proxy object. Users who wish to alter the specifics of the HTTP requests issued by RPC proxy objects may override the protected doXyz methods and pass an instance of the subclass to setRpcRequestBuilder(RpcRequestBuilder).

Summary

Constants
String CONTENT_TYPE_HEADER Used by doSetContentType(RequestBuilder, String).
String MODULE_BASE_HEADER Used by doFinish(RequestBuilder).
String STRONG_NAME_HEADER Used by doFinish(RequestBuilder).
Public Constructors
RpcRequestBuilder()
Public Methods
final RpcRequestBuilder create(String serviceEntryPoint)
Initialize the RpcRequestBuilder.
final RequestBuilder finish()
This method must be called to return the RequestBuilder that the RPC request will be made with.
final RpcRequestBuilder setCallback(RequestCallback callback)
Sets the RequestCallback to be used by the RequestBuilder.
final RpcRequestBuilder setContentType(String contentType)
Sets the MIME content type to be used by the RequestBuilder.
final RpcRequestBuilder setRequestData(String data)
Sets the request data to be sent in the request.
final RpcRequestBuilder setRequestId(int id)
Sets the request id of the request.
Protected Methods
RequestBuilder doCreate(String serviceEntryPoint)
Called by create(String) to instantiate the RequestBuilder object.
void doFinish(RequestBuilder rb)
Called by finish() prior to returning the RequestBuilder to the caller.
void doSetCallback(RequestBuilder rb, RequestCallback callback)
void doSetContentType(RequestBuilder rb, String contentType)
void doSetRequestData(RequestBuilder rb, String data)
void doSetRequestId(RequestBuilder rb, int id)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CONTENT_TYPE_HEADER

Constant Value: "Content-Type"

public static final String MODULE_BASE_HEADER

Constant Value: "X-GWT-Module-Base"

public static final String STRONG_NAME_HEADER

Constant Value: "X-GWT-Permutation"

Public Constructors

public RpcRequestBuilder ()

Public Methods

public final RpcRequestBuilder create (String serviceEntryPoint)

Initialize the RpcRequestBuilder. This method must be called before any of the other methods in this class may be called. Calling create before calling finish() will reset the state of the RpcRequestBuilder.

This method delegates to doCreate(String) to instantiate the RequestBuilder.

Parameters
serviceEntryPoint The URL entry point
Returns
  • this

public final RequestBuilder finish ()

This method must be called to return the RequestBuilder that the RPC request will be made with.

This method will call doFinish(RequestBuilder) before returning the current RequestBuilder.

public final RpcRequestBuilder setCallback (RequestCallback callback)

Sets the RequestCallback to be used by the RequestBuilder. Delegates to doSetCallback(RequestBuilder, RequestCallback).

Parameters
callback the RequestCallback to be used by the RequestBuilder
Returns
  • this

public final RpcRequestBuilder setContentType (String contentType)

Sets the MIME content type to be used by the RequestBuilder. Delegates to doSetContentType(RequestBuilder, String).

Parameters
contentType the MIME content type to be used in the request
Returns
  • this

public final RpcRequestBuilder setRequestData (String data)

Sets the request data to be sent in the request. Delegates to doSetRequestData(RequestBuilder, String).

Parameters
data the data to send
Returns
  • this

public final RpcRequestBuilder setRequestId (int id)

Sets the request id of the request. Delegates to doSetRequestId(RequestBuilder, int).

Parameters
id the issue number of the request
Returns
  • this

Protected Methods

protected RequestBuilder doCreate (String serviceEntryPoint)

Called by create(String) to instantiate the RequestBuilder object.

The default implementation creates a POST RequestBuilder with the given entry point.

Parameters
serviceEntryPoint the URL to which the request should be issued
Returns
  • the RequestBuilder that should be ultimately passed to the RpcRequestBuilder's caller.

protected void doFinish (RequestBuilder rb)

Called by finish() prior to returning the RequestBuilder to the caller.

The default implementation sets the {@value #STRONG_NAME_HEADER} header to the value returned by getPermutationStrongName().

Parameters
rb The RequestBuilder that is currently being configured

protected void doSetCallback (RequestBuilder rb, RequestCallback callback)

Called by setCallback(RequestCallback).

The default implementation calls setCallback(RequestCallback).

Parameters
rb the RequestBuilder that is currently being configured
callback the user-provided callback

protected void doSetContentType (RequestBuilder rb, String contentType)

Called by setContentType(String).

The default implementation sets the {@value #CONTENT_TYPE_HEADER} header to the value specified by contentType by calling setHeader(String, String).

Parameters
rb the RequestBuilder that is currently being configured
contentType the desired MIME type of the request's contents

protected void doSetRequestData (RequestBuilder rb, String data)

Called by setRequestData(String).

The default implementation invokes setRequestData(String).

Parameters
rb the RequestBuilder that is currently being configured
data the data to send

protected void doSetRequestId (RequestBuilder rb, int id)

Called by setRequestId(int).

The default implementation is a no-op.

Parameters
rb the RequestBuilder that is currently being configured
id the request's issue id