Modifier and Type | Class and Description |
---|---|
static interface |
HurlStack.UrlRewriter
An interface for transforming URLs before use.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
HEADER_CONTENT_TYPE |
private javax.net.ssl.SSLSocketFactory |
mSslSocketFactory |
private HurlStack.UrlRewriter |
mUrlRewriter |
Constructor and Description |
---|
HurlStack() |
HurlStack(HurlStack.UrlRewriter urlRewriter) |
HurlStack(HurlStack.UrlRewriter urlRewriter,
javax.net.ssl.SSLSocketFactory sslSocketFactory) |
Modifier and Type | Method and Description |
---|---|
private static void |
addBodyIfExists(java.net.HttpURLConnection connection,
Request<?> request) |
protected java.net.HttpURLConnection |
createConnection(java.net.URL url)
Create an
HttpURLConnection for the specified url . |
private static HttpEntity |
entityFromConnection(java.net.HttpURLConnection connection)
Initializes an
org.apache.http.HttpEntity from the given HttpURLConnection . |
private java.net.HttpURLConnection |
openConnection(java.net.URL url,
Request<?> request)
Opens an
HttpURLConnection with parameters. |
HttpResponse |
performRequest(Request<?> request,
java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
Performs an HTTP request with the given parameters.
|
(package private) static void |
setConnectionParametersForRequest(java.net.HttpURLConnection connection,
Request<?> request) |
private static final java.lang.String HEADER_CONTENT_TYPE
private final HurlStack.UrlRewriter mUrlRewriter
private final javax.net.ssl.SSLSocketFactory mSslSocketFactory
public HurlStack()
public HurlStack(HurlStack.UrlRewriter urlRewriter)
urlRewriter
- Rewriter to use for request URLspublic HurlStack(HurlStack.UrlRewriter urlRewriter, javax.net.ssl.SSLSocketFactory sslSocketFactory)
urlRewriter
- Rewriter to use for request URLssslSocketFactory
- SSL factory to use for HTTPS connectionspublic HttpResponse performRequest(Request<?> request, java.util.Map<java.lang.String,java.lang.String> additionalHeaders) throws java.io.IOException, AuthFailureError
HttpStack
A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise, and the Content-Type header is set to request.getPostBodyContentType().
performRequest
in interface HttpStack
request
- the request to performadditionalHeaders
- additional headers to be sent together with
Request.getHeaders()
java.io.IOException
AuthFailureError
private static HttpEntity entityFromConnection(java.net.HttpURLConnection connection)
org.apache.http.HttpEntity
from the given HttpURLConnection
.connection
- connection
.protected java.net.HttpURLConnection createConnection(java.net.URL url) throws java.io.IOException
HttpURLConnection
for the specified url
.java.io.IOException
private java.net.HttpURLConnection openConnection(java.net.URL url, Request<?> request) throws java.io.IOException
HttpURLConnection
with parameters.url
- java.io.IOException
static void setConnectionParametersForRequest(java.net.HttpURLConnection connection, Request<?> request) throws java.io.IOException, AuthFailureError
java.io.IOException
AuthFailureError
private static void addBodyIfExists(java.net.HttpURLConnection connection, Request<?> request) throws java.io.IOException, AuthFailureError
java.io.IOException
AuthFailureError