java.lang.Object | |
↳ | com.google.gwt.http.client.RequestBuilder |
Known Direct Subclasses |
Builder for constructing Request
objects.
com.google.gwt.http.HTTP
.
{@gwt.include com/google/gwt/examples/http/InheritsExample.gwt.xml}
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RequestBuilder.Method | HTTP request method constants. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DELETE | Specifies that the HTTP DELETE method should be used. | ||||||||||
GET | Specifies that the HTTP GET method should be used. | ||||||||||
HEAD | Specifies that the HTTP HEAD method should be used. | ||||||||||
POST | Specifies that the HTTP POST method should be used. | ||||||||||
PUT | Specifies that the HTTP PUT method should be used. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a builder using the parameters for configuration.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a builder using the parameters values for configuration.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the callback previously set by
setCallback(RequestCallback) , or null if no callback
was set. | |||||||||||
Returns the HTTP method specified in the constructor.
| |||||||||||
Returns the value of a header previous set by
setHeader(String, String) , or null if no such header
was set. | |||||||||||
Returns the password previously set by
setPassword(String) , or
null if no password was set. | |||||||||||
Returns the requestData previously set by
setRequestData(String) ,
or null if no requestData was set. | |||||||||||
Returns the timeoutMillis previously set by
setTimeoutMillis(int) ,
or 0 if no timeoutMillis was set. | |||||||||||
Returns the HTTP URL specified in the constructor.
| |||||||||||
Returns the user previously set by
setUser(String) , or
null if no user was set. | |||||||||||
Sends an HTTP request based on the current builder configuration.
| |||||||||||
Sends an HTTP request based on the current builder configuration with the
specified data and callback.
| |||||||||||
Sets the response handler for this request.
| |||||||||||
Sets a request header with the given name and value.
| |||||||||||
Sets the password to use in the request URL.
| |||||||||||
Sets the data to send as part of this request.
| |||||||||||
Sets the number of milliseconds to wait for a request to complete.
| |||||||||||
Sets the user name that will be used in the request URL.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Specifies that the HTTP DELETE method should be used.
Creates a builder using the parameters for configuration.
httpMethod | HTTP method to use for the request |
---|---|
url | URL that has already has already been encoded. Please see
encode(String) ,
encodePathSegment(String) and
encodeQueryString(String) for
how to do this. |
IllegalArgumentException | if the httpMethod or URL are empty |
---|---|
NullPointerException | if the httpMethod or the URL are null |
Creates a builder using the parameters values for configuration.
httpMethod | HTTP method to use for the request |
---|---|
url | URL that has already has already been URL encoded. Please see
encode(String) and
encodePathSegment(String) and
encodeQueryString(String) for
how to do this. |
IllegalArgumentException | if the httpMethod or URL are empty |
---|---|
NullPointerException | if the httpMethod or the URL are null |
Returns the callback previously set by
setCallback(RequestCallback)
, or null
if no callback
was set.
Returns the value of a header previous set by
setHeader(String, String)
, or null
if no such header
was set.
header | the name of the header |
---|
Returns the password previously set by setPassword(String)
, or
null
if no password was set.
Returns the requestData previously set by setRequestData(String)
,
or null
if no requestData was set.
Returns the timeoutMillis previously set by setTimeoutMillis(int)
,
or 0
if no timeoutMillis was set.
Returns the user previously set by setUser(String)
, or
null
if no user was set.
Sends an HTTP request based on the current builder configuration. If no
request headers have been set, the header "Content-Type" will be used with
a value of "text/plain; charset=utf-8". You must call
setRequestData(String)
and setCallback(RequestCallback)
before calling this method.
Request
object that can be used to track the requestRequestException | if the call fails to initiate |
---|---|
NullPointerException | if a request callback has not been set |
Sends an HTTP request based on the current builder configuration with the
specified data and callback. If no request headers have been set, the
header "Content-Type" will be used with a value of "text/plain;
charset=utf-8". This method does not cache requestData
or
callback
.
requestData | the data to send as part of the request |
---|---|
callback | the response handler to be notified when the request fails or completes |
Request
object that can be used to track the requestNullPointerException | if callback null
|
---|---|
RequestException |
Sets the response handler for this request. This method must be
called before calling send()
.
callback | the response handler to be notified when the request fails or completes |
---|
NullPointerException | if callback is null
|
---|
Sets a request header with the given name and value. If a header with the specified name has already been set then the new value overwrites the current value.
header | the name of the header |
---|---|
value | the value of the header |
NullPointerException | if header or value are null |
---|---|
IllegalArgumentException | if header or value are the empty string |
Sets the password to use in the request URL. This is ignored if there is no user specified.
password | password to use in the request URL |
---|
IllegalArgumentException | if the password is empty |
---|---|
NullPointerException | if the password is null |
Sets the data to send as part of this request. This method must be
called before calling send()
.
requestData | the data to send as part of the request |
---|
Sets the number of milliseconds to wait for a request to complete. Should
the request timeout, the
onError(Request, Throwable)
method will be called on the callback instance given to the
sendRequest(String, RequestCallback)
method. The callback method will receive an instance of the
RequestTimeoutException
class as its
Throwable
argument.
timeoutMillis | number of milliseconds to wait before canceling the request, a value of zero disables timeouts |
---|
IllegalArgumentException | if the timeout value is negative |
---|
Sets the user name that will be used in the request URL.
user | user name to use |
---|
IllegalArgumentException | if the user is empty |
---|---|
NullPointerException | if the user is null |