Jetty HTTP Client
The HttpClient is an implementation of the client API. It makes it easy to conduct exchanges with a server, and to process the responses. It can be either be blocking or non-blocking, depending on the connector type; default is to use non-blocking. The HttpClient can also do SSL and use proxies.
To send a request, use the
send(HttpExchange exchange) method. The exchange contains both the headers and content (source) of the request plus the callbacks to handle responses. A HttpClient can have many exchanges outstanding.
Asynchronous Client Example
Synchronous Client Example
To get HttpExchange.ContentExchange to do synchronous work, one can create a class FailableContentExchange
and use it to do a synchronous request, as described in the example below