Jetty has moved!
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/
Contact the core Jetty developers at www.webtide.com
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
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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

  • No labels
Contact the core Jetty developers at www.webtide.com
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