Jetty is a project at the Eclipse Foundation.
| Homepage: | http://www.eclipse.org/jetty |
| Downloads: | http://download.eclipse.org/jetty/ |
| Documentation: | http://www.eclipse.org/jetty/documentation/current/ |
| About: | http://www.eclipse.org/jetty/about.php |
| Jetty Powered: | http://www.eclipse.org/jetty/powered/ |
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
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