Package org.eclipse.jetty.client


package org.eclipse.jetty.client
Jetty Client : Implementation and Core Classes This package provides APIs, utility classes and an implementation of an asynchronous HTTP client.

The core class is HttpClient, which acts as a central configuration object (for example for idle timeouts, max connections per destination, etc.) and as a factory for Request objects.

The HTTP protocol is based on the request/response paradigm, a unit that in this implementation is called exchange and is represented by HttpExchange. An initial request may trigger a sequence of exchanges with one or more servers, called a conversation and represented by HttpConversation. A typical example of a conversation is a redirect, where upon a request for a resource URI, the server replies with a redirect (for example with the 303 status code) to another URI. This conversation is made of a first exchange made of the original request and its 303 response, and of a second exchange made of the request for the new URI and its 200 response.

HttpClient holds a number of destinations, which in turn hold a number of pooled connections.

When a request is sent, its exchange is associated to a connection, either taken from an idle queue or created anew, and when both the request and response are completed, the exchange is disassociated from the connection. Conversations may span multiple connections on different destinations, and therefore are maintained at the HttpClient level.

Applications may decide to send the request and wait for the response in a blocking way, using Request.send(). Alternatively, application may ask to be notified of response events asynchronously, using Request.send(org.eclipse.jetty.client.api.Response.CompleteListener).