java.lang.Object | |
↳ | android.net.http.AndroidHttpClient |
Subclass of the Apache DefaultHttpClient
that is configured with
reasonable default settings and registered schemes for Android, and
also lets the user add HttpRequestInterceptor
classes.
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.
| |||||||||||
Create a new HttpClient with reasonable defaults (which you can update).
| |||||||||||
Create a new HttpClient with reasonable defaults (which you can update).
| |||||||||||
Returns the date of the given HTTP date string.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called before the object's memory is reclaimed by the VM.
|
[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 |
---|
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) |
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.
|
---|
Called before the object's memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue
, because it provides more control
over the way the VM deals with references during garbage collection.
Throwable |
---|