Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jersey.client.apache
Class ApacheHttpClient

    java.lang.Object
      com.sun.jersey.api.client.filter.Filterable
          com.sun.jersey.api.client.Client
              com.sun.jersey.client.apache.ApacheHttpClient

All Implemented Interfaces:
  ClientHandler

    public class ApacheHttpClient

extends Client

A `Client` that utilizes the Apache HTTP client to send and receive HTTP request and responses.

If an `ApacheHttpClientHandler` is not explicitly passed as a constructor or method parameter then by default an instance is created with an `HttpClient` constructed with a `MultiThreadedHttpConnectionManager` instance.

The following properties are only supported at construction of this class: `ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION` and `ClientConfig.PROPERTY_CONNECT_TIMEOUT`.

By default a request entity is buffered and repeatable such that authorization may be performed automatically in response to a 401 response.

If the property `ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE` size is set to a value greater than 0 then chunked encoding will be enabled and the request entity (if present) will not be buffered and is not repeatable. For authorization to work in such scenarios the property `ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION` must be set to true.

If a response entity is obtained that is an instance of `Closeable` then the instance MUST be closed after processing the entity to release connection-based resources.

If a `ClientResponse` is obtained and an entity is not read from the response then `ClientResponse.close()` MUST be called after processing the response to release connection-based resources.

Author:
  jorgeluisw@mac.com, Paul.Sandoz@Sun.Com

Constructor Summary
`ApacheHttpClient()` Create a new client instance.
`ApacheHttpClient(ApacheHttpClientHandler root)` Create a new client instance.
`ApacheHttpClient(ApacheHttpClientHandler root, ClientConfig config, IoCComponentProviderFactory provider)` Deprecated. the config parameter is no longer utilized and instead the config obtained from the `ApacheHttpClientHandler.getConfig()` is utilized instead.
`ApacheHttpClient(ApacheHttpClientHandler root, IoCComponentProviderFactory provider)` Create a new instance with a client configuration and a component provider.

Method Summary
`static ApacheHttpClient` | `create()` Create a default client.
`static ApacheHttpClient` | `create(ClientConfig cc)` Create a default client with client configuration.
`static ApacheHttpClient` | `create(ClientConfig cc, IoCComponentProviderFactory provider)` Create a default client with client configuration and component provider.
`ApacheHttpClientHandler` | `getClientHandler()` Get the Apache HTTP client handler.

Methods inherited from class com.sun.jersey.api.client.Client
`asyncResource, asyncResource, asyncView, asyncView, asyncView, asyncView, asyncViewResource, asyncViewResource, destroy, finalize, getExecutorService, getMessageBodyWorkers, getProperties, getProviders, getViewProxy, handle, inject, resource, resource, setChunkedEncodingSize, setConnectTimeout, setExecutorService, setFollowRedirects, setReadTimeout, view, view, view, view, view, view, viewResource, viewResource`

Methods inherited from class com.sun.jersey.api.client.filter.Filterable
`addFilter, getHeadHandler, isFilterPreset, removeAllFilters, removeFilter`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ApacheHttpClient

    public ApacheHttpClient()

  Create a new client instance.

### ApacheHttpClient

    public ApacheHttpClient(ApacheHttpClientHandler root)

  Create a new client instance.

  Parameters:
    `root` - the root client handler for dispatching a request and returning a response.

### ApacheHttpClient

    @Deprecated
    public ApacheHttpClient(ApacheHttpClientHandler root,
                                       ClientConfig config,
                                       IoCComponentProviderFactory provider)

  Deprecated. the config parameter is no longer utilized and instead the config obtained from the `ApacheHttpClientHandler.getConfig()` is utilized instead.

  Create a new instance with a client configuration and a component provider.

  Parameters:
    `root` - the root client handler for dispatching a request and returning a response.
    `config` - the client configuration.
    `provider` - the IoC component provider factory.

### ApacheHttpClient

    public ApacheHttpClient(ApacheHttpClientHandler root,
                            IoCComponentProviderFactory provider)

  Create a new instance with a client configuration and a component provider.

  Parameters:
    `root` - the root client handler for dispatching a request and returning a response.
    `provider` - the IoC component provider factory.

Method Detail

### getClientHandler

    public ApacheHttpClientHandler getClientHandler()

  Get the Apache HTTP client handler.

  Returns:
    the Apache HTTP client handler.

### create

    public static ApacheHttpClient create()

  Create a default client.

  Returns:
    a default client.

### create

    public static ApacheHttpClient create(ClientConfig cc)

  Create a default client with client configuration.

  Parameters:
    `cc` - the client configuration.
  Returns:
    a default client.

### create

    public static ApacheHttpClient create(ClientConfig cc,
                                          IoCComponentProviderFactory provider)

  Create a default client with client configuration and component provider.

  Parameters:
    `cc` - the client configuration.
    `provider` - the IoC component provider factory.
  Returns:
    a default client.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 Oracle Corporation. All Rights Reserved.