|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
AsyncUniformInterface | An asynchronous uniform interface for invoking HTTP requests. |
ClientHandler | A client handler that handles a HTTP request and returns the HTTP response. |
ClientRequestAdapter | Adapter for the client request to adapt the output stream to write the entity. |
RequestBuilder<T extends RequestBuilder> | An interface for building requests. |
UniformInterface | A uniform interface for invoking HTTP requests. |
Class Summary | |
---|---|
AbstractClientRequestAdapter | Abstract implementation of ClientRequestAdapter that helps to adapts an existing ClientRequestAdapter instance. |
AsyncWebResource | An encapsulation of an asynchronous Web resource capable of building requests to send to the Web resource and processing responses returned from the Web resource. |
Client | The main class for creating WebResource instances and configuring
the properties of connections and requests. |
ClientRequest | A client (out-bound) HTTP request. |
ClientRequest.Builder | The builder for building a ClientRequest instance. |
ClientResponse | A client (in-bound) HTTP response. |
GenericType<T> | Represents a generic type T . |
PartialRequestBuilder<T extends RequestBuilder> | A partial implementation of RequestBuilder that implements
the methods on RequestBuilder but leaves undefined the build
methods for constructing the request. |
WebResource | An encapsulation of a Web resource capable of building requests to send to the Web resource and processing responses returned from the Web resource. |
Exception Summary | |
---|---|
ClientHandlerException | A runtime exception thrown by a client handler that signals a failure to process the HTTP request or HTTP response. |
UniformInterfaceException | A runtime exception thrown by a method on the UniformInterface when
the status code of the HTTP response indicates a response that is not
expected by the method invoked. |
Provides support for client-side communication with HTTP-based RESTful Web services.
The client API is high-level API that reuses many aspects of the JAX-RS API. It is designed to be quick, easy to use and is especially useful and productive when developing tests for Web services.
The client API can be used as follows to make simple GET and POST requests to a Web resource:
Client c = Client.create(); WebResource r = c.resource("http://host/base"); String s = r.get(String.class); s = r.post(String.class, s);
A key concept of REST is the uniform interface and this is encapsulated in
the WebResource
class, which implements
UniformInterface
.
A request is built up and when the corresponding HTTP method on the
UniformInterface
is invoked the request
is sent to the Web resource and the returned response is processed. This enables
efficient production of requests as follows:
In the above example a GET request occurs stating that the "application/xml" is acceptable. After that a POST request occurs stating the same acceptable media type and that the content type of the request entity is "application/xml".WebResource r = ... String s = r.accept("application/xml").get(String.class); s = r.accept("application/xml").type("application/xml").post(String.class, s);
The Java types that may be used for request and response entities are not
restricted to String
. The client API reuses the same infrastrucure
as JAX-RS server-side. Thus the same types that can be used on the server-side
can also be used on the client-side, such as JAXB-based types. Further more
the supported Java types can be extended by implementing
MessageBodyReader
and
MessageBodyWriter
. For registration of such support
for new Java types see
ClientConfig
.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |