Trying to implement an example using HttpExchange

I am trying to implement the code in the Asynchronous Exchanges section of this link in the documentation for the pier: http://wiki.eclipse.org/Jetty/Tutorial/HttpClient#Asynchronous_Exchanges

HttpExchange exchange = new HttpExchange();

// Optionally set the HTTP method
exchange.setMethod("POST");

exchange.setAddress(new Address("ping.host.com", 80));
exchange.setURI("/ping");
// Or, equivalently, this:
exchange.setURL("http://ping.host.com/ping");

client.send(exchange);

System.out.println("Exchange sent");

I am trying to figure out which HttpExchange class is used. I loaded the pier from here http://download.eclipse.org/jetty/

but could not find a link to HttpExchange anywhere in the files. Could this be an HttpExchange from com.sun.net.httpserver? When I try to use it in the sun, I get an error message indicating that the class does not have an HttpExchange () constructor (without parameters).

+3
source share
1 answer

This org.eclipse.jetty.client.HttpExchangeis assuming you are using a version from Eclipse.

+2
source

All Articles