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 14 Current »

Jetty HTTP Client

Improved Tutorial at Eclipse

Icon

Jetty 6 and Jetty 7 HTTP clients are very similar, almost identical.
You may want to follow a detailed tutorial here for Jetty 7, which will be mostly valid for Jetty 6 too.

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 use either blocking or non-blocking connectors, the default is to use non-blocking. The HttpClient can also do SSL, use proxies and authentication.

By nature it is asynchronous. To begin a request, create an HttpExchange instance (or a subclass of it). HttpExchange provides a number of callback methods that you implement in order to receive reply. You can be notified of the receipt of particular parts of the response, such as the headers or just the content. To start the request, call
HttpClient.send(HttpExchange) method. A single HttpClient can have many exchanges outstanding.

Asynchronous Request Example

Synchronous Request Example

You can perform a synchronous request by using the HttpExchange.waitForDone() method.

  • 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