Package com.google.gwt.http.client

Provides the client-side classes and interfaces for making HTTP requests and processing the associated responses.

See:
          Description

Interface Summary
RequestCallback The primary interface a caller must implement to receive a response to a Request.
 

Class Summary
Header Class for describing an HTTP header.
Request An HTTP request that is waiting for a response.
RequestBuilder Builder for constructing Request objects.
RequestBuilder.Method HTTP request method constants.
Response Wrapper which provides access to the components of an HTTP response.
URL Utility class for the encoding and decoding URLs in their entirety or by their individual components.
UrlBuilder Utility class to build a URL from components.
 

Exception Summary
RequestException RequestException is the superclass for the HTTP request related exceptions.
RequestPermissionException Exception thrown when the RequestBuilder attempts to make a request to a URL which violates the Same-Origin Security Policy.
RequestTimeoutException Thrown to indicate that an HTTP request has timed out.
 

Package com.google.gwt.http.client Description

Provides the client-side classes and interfaces for making HTTP requests and processing the associated responses.

Most applications will be interested in the Request, RequestBuilder, RequestCallback and Response classes.

Caveats

Same-Origin Security Policy

Modern web browsers restrict client-side scripts from accessing items outside of their source origin. This means that a script loaded from www.foo.com cannot access content from www.bar.com. For more details please see, Same-Origin Security Policy.

Pending Request Limit

Modern web browsers are limited to having only two HTTP requests outstanding at any one time. If your server experiences an error that prevents it from sending a response, it can tie up your outstanding requests. If you are concerned about this, you can always set timeouts for the request via RequestBuilder.setTimeoutMillis(int).

Required Module

Modules that use the classes and interfaces in this package should inherit the com.google.gwt.http.HTTP module.

Quick Howto's

How should I write a RequestCallback handler class?

The following code shows how a RequestCallback instance should be written.

How do I make a GET request?

The following example demonstrates how to perform an HTTP GET request.

How do I make a POST request?

The following example demonstrates how to perform an HTTP POST request.

How do I use request timeouts?

The following example demonstrates how to use the timeout feature.

How do I construct a string for use in a query or POST body?

The following example demonstrates how to build a x-www-form-urlencoded string that can be used as a query string or as the body of a POST request.

How can I make a RequestBuilder send a request other than GET or POST?

The following example demonstrates how to allow an HTTP request other than a GET or a POST to be made. Beware: if you plan on supporting Safari, you cannot use this scheme.