See: Description
Interface | Description |
---|---|
ApacheHttpMethodExecutor |
An Apache HTTP method executor.
|
Class | Description |
---|---|
ApacheHttpClient |
A
Client that utilizes the Apache HTTP client to send and receive
HTTP request and responses. |
ApacheHttpClientHandler |
A root handler with Jakarta Commons HttpClient acting as a backend.
|
DefaultApacheHttpMethodExecutor |
A default implementation of an Apache HTTP method executor.
|
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.