public final class AndroidHttpClient extends Object implements org.apache.http.client.HttpClient
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(java.lang.String, android.content.Context) 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);
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_SYNC_MIN_GZIP_BYTES |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Release resources associated with this client.
|
void |
disableCurlLogging()
Disables cURL logging for this client.
|
void |
enableCurlLogging(String name,
int level)
Enables cURL request logging for this client.
|
org.apache.http.HttpResponse |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request) |
org.apache.http.HttpResponse |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context) |
<T> T |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler) |
<T> T |
execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context) |
org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpUriRequest request) |
org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.protocol.HttpContext context) |
<T> T |
execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler) |
<T> T |
execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context) |
protected void |
finalize() |
static org.apache.http.entity.AbstractHttpEntity |
getCompressedEntity(byte[] data,
android.content.ContentResolver resolver)
Compress data to send to server.
|
org.apache.http.conn.ClientConnectionManager |
getConnectionManager() |
static long |
getMinGzipSize(android.content.ContentResolver resolver)
Retrieves the minimum size for compressing data.
|
org.apache.http.params.HttpParams |
getParams() |
static InputStream |
getUngzippedContent(org.apache.http.HttpEntity entity)
Gets the input stream from a response entity.
|
static void |
modifyRequestToAcceptGzipResponse(org.apache.http.HttpRequest request)
Modifies a request to indicate to the server that we would like a
gzipped response.
|
static AndroidHttpClient |
newInstance(String userAgent)
Create a new HttpClient with reasonable defaults (which you can update).
|
static AndroidHttpClient |
newInstance(String userAgent,
android.content.Context context)
Create a new HttpClient with reasonable defaults (which you can update).
|
static long |
parseDate(String dateString)
Returns the date of the given HTTP date string.
|
public static AndroidHttpClient newInstance(String userAgent, android.content.Context context)
userAgent - to report in your HTTP requestscontext - to use for caching SSL sessions (may be null for no caching)public static AndroidHttpClient newInstance(String userAgent)
userAgent - to report in your HTTP requests.protected void finalize()
throws Throwable
public static void modifyRequestToAcceptGzipResponse(org.apache.http.HttpRequest request)
request - the request to modifygetUngzippedContent(org.apache.http.HttpEntity)public static InputStream getUngzippedContent(org.apache.http.HttpEntity entity) throws IOException
entity - the entity whose content should be readIOExceptionpublic void close()
public org.apache.http.params.HttpParams getParams()
getParams in interface org.apache.http.client.HttpClientpublic org.apache.http.conn.ClientConnectionManager getConnectionManager()
getConnectionManager in interface org.apache.http.client.HttpClientpublic org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest request)
throws IOException
execute in interface org.apache.http.client.HttpClientIOExceptionpublic org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.protocol.HttpContext context)
throws IOException
execute in interface org.apache.http.client.HttpClientIOExceptionpublic org.apache.http.HttpResponse execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request)
throws IOException
execute in interface org.apache.http.client.HttpClientIOExceptionpublic org.apache.http.HttpResponse execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.protocol.HttpContext context)
throws IOException
execute in interface org.apache.http.client.HttpClientIOExceptionpublic <T> T execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler)
throws IOException,
org.apache.http.client.ClientProtocolException
execute in interface org.apache.http.client.HttpClientIOExceptionorg.apache.http.client.ClientProtocolExceptionpublic <T> T execute(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context)
throws IOException,
org.apache.http.client.ClientProtocolException
execute in interface org.apache.http.client.HttpClientIOExceptionorg.apache.http.client.ClientProtocolExceptionpublic <T> T execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler)
throws IOException,
org.apache.http.client.ClientProtocolException
execute in interface org.apache.http.client.HttpClientIOExceptionorg.apache.http.client.ClientProtocolExceptionpublic <T> T execute(org.apache.http.HttpHost target,
org.apache.http.HttpRequest request,
org.apache.http.client.ResponseHandler<? extends T> responseHandler,
org.apache.http.protocol.HttpContext context)
throws IOException,
org.apache.http.client.ClientProtocolException
execute in interface org.apache.http.client.HttpClientIOExceptionorg.apache.http.client.ClientProtocolExceptionpublic static org.apache.http.entity.AbstractHttpEntity getCompressedEntity(byte[] data,
android.content.ContentResolver resolver)
throws IOException
data - The bytes to compressIOExceptionpublic static long getMinGzipSize(android.content.ContentResolver resolver)
public void enableCurlLogging(String name, int level)
name - to log messages withlevel - at which to log messages (see Log)public void disableCurlLogging()
public static long parseDate(String dateString)
IllegalArgumentException - if dateString is not a date or
of an unsupported format.Copyright © 2012–2014 simpligility technologies inc.. All rights reserved.