Package com.sun.jersey.client.apache

Provides support for the Client API that utilizes the Apache HTTP client to send and receive HTTP request and responses.

See: Description

Package com.sun.jersey.client.apache Description

Provides support for the Client API that utilizes the Apache HTTP client to send and receive HTTP request and responses.

The client API with the Apache HTTP client can be used as follows to make simple GET and POST requests to a Web resource:

     Client c = ApacheHttpClient.create();
     WebResource r = c.resource("http://host/base");
     String s = r.get(String.class);
     s = r.post(String.class, s);
 

To support basic authentication with the user name "foo" and the password "bar" the following configuration may be utilized:

     DefaultApacheHttpClientConfig config = new DefaultApacheHttpClientConfig();
     config.getState().setCredentials(null, null, -1, "foo", "bar");
     ApacheHttpClient c = ApacheHttpClient.create(config);
     WebResource r = c.resource("http://host/base");
     String s = r.get(String.class);
     s = r.post(String.class, s);
 

Copyright © 2013 Oracle Corporation. All rights reserved.