public class UrlHttpClient extends Object implements HttpClient
HttpClient
by HttpURLConnection
. This is
the recommended HTTP client in Android. Compared to ApacheHttpClient
,
it has one limitation. When handling 'Expected 100-continue' header, it only
accepts either 100 continue or 417 reject, and throws
ProtocolException
on other status code. Such limitation will cause
some issue when talking to S3 service. See S3's
Put Object API for the requirement of handling 100-continue.Modifier and Type | Class and Description |
---|---|
protected class |
UrlHttpClient.CurlBuilder
Helper class to build a curl message.
|
Constructor and Description |
---|
UrlHttpClient(ClientConfiguration config)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
execute(HttpRequest request)
Executes a
HttpRequest and returns a HttpResponse . |
protected HttpURLConnection |
getUrlConnection(URL url) |
protected void |
printToLog(String message) |
void |
shutdown()
This is no op.
|
public UrlHttpClient(ClientConfiguration config)
config
- the client config.public HttpResponse execute(HttpRequest request) throws IOException
HttpClient
HttpRequest
and returns a HttpResponse
.execute
in interface HttpClient
request
- a HTTP requestIOException
- in case of a connection problempublic void shutdown()
shutdown
in interface HttpClient
protected void printToLog(String message)
protected HttpURLConnection getUrlConnection(URL url) throws IOException
IOException
Copyright © 2018. All rights reserved.