|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.net.http.AndroidHttpClient
public final class 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(java.lang.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);
| Field Summary | |
|---|---|
static long |
DEFAULT_SYNC_MIN_GZIP_BYTES
|
| Method Summary | ||
|---|---|---|
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. |
|
HttpResponse |
execute(HttpHost target,
HttpRequest request)
Executes a request to the target using the default context. |
|
HttpResponse |
execute(HttpHost target,
HttpRequest request,
HttpContext context)
Executes a request to the target using the given context. |
|
|
execute(HttpHost target,
HttpRequest request,
ResponseHandler<? extends T> responseHandler)
Executes a request to the target using the default context and processes the response using the given response handler. |
|
|
execute(HttpHost target,
HttpRequest request,
ResponseHandler<? extends T> responseHandler,
HttpContext context)
Executes a request to the target using the given context and processes the response using the given response handler. |
|
HttpResponse |
execute(HttpUriRequest request)
Executes a request using the default context. |
|
HttpResponse |
execute(HttpUriRequest request,
HttpContext context)
Executes a request using the given context. |
|
|
execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler)
Executes a request using the default context and processes the response using the given response handler. |
|
|
execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler,
HttpContext context)
Executes a request using the given context and processes the response using the given response handler. |
|
protected void |
finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. |
|
static AbstractHttpEntity |
getCompressedEntity(byte[] data,
ContentResolver resolver)
Compress data to send to server. |
|
ClientConnectionManager |
getConnectionManager()
Obtains the connection manager used by this client. |
|
static long |
getMinGzipSize(ContentResolver resolver)
Retrieves the minimum size for compressing data. |
|
HttpParams |
getParams()
Obtains the parameters for this client. |
|
static InputStream |
getUngzippedContent(HttpEntity entity)
Gets the input stream from a response entity. |
|
static void |
modifyRequestToAcceptGzipResponse(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 void |
setThreadBlocked(boolean blocked)
Block this thread from executing HTTP requests. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static long DEFAULT_SYNC_MIN_GZIP_BYTES
| Method Detail |
|---|
public static AndroidHttpClient newInstance(String userAgent)
userAgent - to report in your HTTP requests.
protected void finalize()
throws Throwable
ObjectNote: The virtual machine assumes that the implementation in class Object is empty.
finalize in class ObjectThrowable - The virtual machine ignores any exceptions which are
thrown during finalization.public static void setThreadBlocked(boolean blocked)
blocked - if HTTP requests run on this thread should be deniedpublic static void modifyRequestToAcceptGzipResponse(HttpRequest request)
request - the request to modifygetUngzippedContent(org.apache.http.HttpEntity)
public static InputStream getUngzippedContent(HttpEntity entity)
throws IOException
entity - the entity whose content should be read
IOExceptionpublic void close()
public HttpParams getParams()
HttpClient
getParams in interface HttpClientpublic ClientConnectionManager getConnectionManager()
HttpClient
getConnectionManager in interface HttpClient
public HttpResponse execute(HttpUriRequest request)
throws IOException
HttpClient
execute in interface HttpClientrequest - the request to execute
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public HttpResponse execute(HttpUriRequest request,
HttpContext context)
throws IOException
HttpClient
execute in interface HttpClientrequest - the request to executecontext - the context to use for the execution, or
null to use the default context
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public HttpResponse execute(HttpHost target,
HttpRequest request)
throws IOException
HttpClient
execute in interface HttpClienttarget - 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 - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public HttpResponse execute(HttpHost target,
HttpRequest request,
HttpContext context)
throws IOException
HttpClient
execute in interface HttpClienttarget - 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 executecontext - the context to use for the execution, or
null to use the default context
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public <T> T execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler)
throws IOException,
ClientProtocolException
HttpClient
execute in interface HttpClientrequest - the request to executeresponseHandler - the response handler
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public <T> T execute(HttpUriRequest request,
ResponseHandler<? extends T> responseHandler,
HttpContext context)
throws IOException,
ClientProtocolException
HttpClient
execute in interface HttpClientrequest - the request to executeresponseHandler - the response handler
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public <T> T execute(HttpHost target,
HttpRequest request,
ResponseHandler<? extends T> responseHandler)
throws IOException,
ClientProtocolException
HttpClient
execute in interface HttpClienttarget - 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 executeresponseHandler - the response handler
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public <T> T execute(HttpHost target,
HttpRequest request,
ResponseHandler<? extends T> responseHandler,
HttpContext context)
throws IOException,
ClientProtocolException
HttpClient
execute in interface HttpClienttarget - 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 executeresponseHandler - the response handlercontext - the context to use for the execution, or
null to use the default context
IOException - in case of a problem or the connection was aborted
ClientProtocolException - in case of an http protocol error
public static AbstractHttpEntity getCompressedEntity(byte[] data,
ContentResolver resolver)
throws IOException
data - The bytes to compress
IOExceptionpublic static long getMinGzipSize(ContentResolver resolver)
public void enableCurlLogging(String name,
int level)
name - to log messages withlevel - at which to log messages (see Log)public void disableCurlLogging()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||