public class ApacheHttpClient4 extends Client
Client
that utilizes the Apache HTTP Client to send and receive
HTTP request and responses.
The following properties are only supported at construction of this class:
ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER
ApacheHttpClient4Config.PROPERTY_HTTP_PARAMS
}
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER
}
ApacheHttpClient4Config.PROPERTY_DISABLE_COOKIES
}
ApacheHttpClient4Config.PROPERTY_PROXY_URI
}
ApacheHttpClient4Config.PROPERTY_PROXY_USERNAME
}
ApacheHttpClient4Config.PROPERTY_PROXY_PASSWORD
}
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION
}
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
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION
must
be set to true.
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.
ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER
Constructor and Description |
---|
ApacheHttpClient4()
Create a new client instance.
|
ApacheHttpClient4(ApacheHttpClient4Handler root)
Create a new client instance.
|
ApacheHttpClient4(ApacheHttpClient4Handler root,
ClientConfig config)
Create a new client instance with a client configuration.
|
ApacheHttpClient4(ApacheHttpClient4Handler root,
ClientConfig config,
IoCComponentProviderFactory provider)
Create a new instance with a client configuration and a
component provider.
|
Modifier and Type | Method and Description |
---|---|
static ApacheHttpClient4 |
create()
Create a default client.
|
static ApacheHttpClient4 |
create(ClientConfig cc)
Create a default client with client configuration.
|
static ApacheHttpClient4 |
create(ClientConfig cc,
IoCComponentProviderFactory provider)
Create a default client with client configuration and component provider.
|
ApacheHttpClient4Handler |
getClientHandler()
Get the Apache HTTP client handler.
|
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
addFilter, getHeadHandler, isFilterPreset, removeAllFilters, removeFilter
public ApacheHttpClient4()
public ApacheHttpClient4(ApacheHttpClient4Handler root)
root
- the root client handler for dispatching a request and
returning a response.public ApacheHttpClient4(ApacheHttpClient4Handler root, ClientConfig config)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.public ApacheHttpClient4(ApacheHttpClient4Handler root, ClientConfig config, IoCComponentProviderFactory provider)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.provider
- the IoC component provider factory.public ApacheHttpClient4Handler getClientHandler()
public static ApacheHttpClient4 create()
public static ApacheHttpClient4 create(ClientConfig cc)
cc
- the client configuration.public static ApacheHttpClient4 create(ClientConfig cc, IoCComponentProviderFactory provider)
cc
- the client configuration.provider
- the IoC component provider factory.Copyright © 2013 Oracle Corporation. All rights reserved.