java.lang.Object | |
↳ | android.net.http.AndroidHttpClient |
This class is deprecated.
Please use URLConnection
and friends instead.
The Apache HTTP client is no longer maintained and may be removed in a future
release. Please visit this webpage
for further details.
Implementation of the Apache DefaultHttpClient
that is configured with
reasonable default settings and registered schemes for Android.
Don't create this directly, use the newInstance(String)
factory method.
This client processes cookies but does not retain them by default. To retain cookies, simply add a cookie store to the HttpContext:
context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DEFAULT_SYNC_MIN_GZIP_BYTES |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Release resources associated with this client.
| |||||||||||
Disables cURL logging for this client.
| |||||||||||
Enables cURL request logging for this client.
| |||||||||||
Executes a request using the default context.
| |||||||||||
Executes a request to the target using the given context and
processes the response using the given response handler.
| |||||||||||
Executes a request using the given context.
| |||||||||||
Executes a request using the default context and processes the
response using the given response handler.
| |||||||||||
Executes a request to the target using the default context and
processes the response using the given response handler.
| |||||||||||
Executes a request using the given context and processes the
response using the given response handler.
| |||||||||||
Executes a request to the target using the default context.
| |||||||||||
Executes a request to the target using the given context.
| |||||||||||
Compress data to send to server.
| |||||||||||
Obtains the connection manager used by this client.
| |||||||||||
Retrieves the minimum size for compressing data.
| |||||||||||
Obtains the parameters for this client.
| |||||||||||
Gets the input stream from a response entity.
| |||||||||||
Modifies a request to indicate to the server that we would like a
gzipped response.
| |||||||||||
This method is deprecated.
Please use
URLConnection and friends instead. See
SSLCertificateSocketFactory for SSL cache support. If you'd
like to set a custom useragent, please use setRequestProperty(String, String)
with field set to User-Agent .
| |||||||||||
This method is deprecated.
Please use
URLConnection and friends instead. See
SSLCertificateSocketFactory for SSL cache support. If you'd
like to set a custom useragent, please use setRequestProperty(String, String)
with field set to User-Agent .
| |||||||||||
Returns the date of the given HTTP date string.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.apache.http.client.HttpClient
|
Release resources associated with this client. You must call this, or significant resources (sockets and memory) may be leaked.
Enables cURL request logging for this client.
name | to log messages with |
---|---|
level | at which to log messages (see Log )
|
Executes a request using the default context.
request | the request to execute |
---|
IOException |
---|
Executes a request to the target using the given context and processes the response using the given response handler.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
responseHandler | the response handler |
context | the context to use for the execution, or
null to use the default context |
Executes a request using the given context. The route to the target will be determined by the HTTP client.
request | the request to execute |
---|---|
context | the context to use for the execution, or
null to use the default context |
IOException |
---|
Executes a request using the default context and processes the response using the given response handler.
request | the request to execute |
---|---|
responseHandler | the response handler |
Executes a request to the target using the default context and processes the response using the given response handler.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
responseHandler | the response handler |
Executes a request using the given context and processes the response using the given response handler.
request | the request to execute |
---|---|
responseHandler | the response handler |
Executes a request to the target using the default context.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
IOException |
---|
Executes a request to the target using the given context.
target | the target host for the request.
Implementations may accept null
if they can still determine a route, for example
to a default target or by inspecting the request. |
---|---|
request | the request to execute |
context | the context to use for the execution, or
null to use the default context |
IOException |
---|
Compress data to send to server. Creates a Http Entity holding the gzipped data. The data will not be compressed if it is too short.
data | The bytes to compress |
---|
IOException |
---|
Obtains the connection manager used by this client.
Retrieves the minimum size for compressing data. Shorter data will not be compressed.
Obtains the parameters for this client. These parameters will become defaults for all requests being executed with this client, and for the parameters of dependent objects in this client.
Gets the input stream from a response entity. If the entity is gzipped then this will get a stream over the uncompressed data.
entity | the entity whose content should be read |
---|
IOException |
---|
Modifies a request to indicate to the server that we would like a gzipped response. (Uses the "Accept-Encoding" HTTP header.)
request | the request to modify |
---|
This method is deprecated.
Please use URLConnection
and friends instead. See
SSLCertificateSocketFactory
for SSL cache support. If you'd
like to set a custom useragent, please use setRequestProperty(String, String)
with field
set to User-Agent
.
Create a new HttpClient with reasonable defaults (which you can update).
userAgent | to report in your HTTP requests |
---|---|
context | to use for caching SSL sessions (may be null for no caching) |
This method is deprecated.
Please use URLConnection
and friends instead. See
SSLCertificateSocketFactory
for SSL cache support. If you'd
like to set a custom useragent, please use setRequestProperty(String, String)
with field
set to User-Agent
.
Create a new HttpClient with reasonable defaults (which you can update).
userAgent | to report in your HTTP requests. |
---|
Returns the date of the given HTTP date string. This method can identify and parse the date formats emitted by common HTTP servers, such as RFC 822, RFC 850, RFC 1036, RFC 1123 and ANSI C's asctime().
IllegalArgumentException | if dateString is not a date or
of an unsupported format.
|
---|
Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.
Note that objects that override finalize
are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit close
method (and implement
Closeable
), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you must use finalizers, consider at least providing your own
ReferenceQueue
and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling super.finalize()
yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
Throwable |
---|