com.android.volley.toolbox
Class HurlStack

java.lang.Object
  extended by com.android.volley.toolbox.HurlStack
All Implemented Interfaces:
HttpStack

public class HurlStack
extends Object
implements HttpStack

An HttpStack based on HttpURLConnection.


Nested Class Summary
static interface HurlStack.UrlRewriter
          An interface for transforming URLs before use.
 
Constructor Summary
HurlStack()
           
HurlStack(HurlStack.UrlRewriter urlRewriter)
           
HurlStack(HurlStack.UrlRewriter urlRewriter, SSLSocketFactory sslSocketFactory)
           
 
Method Summary
protected  HttpURLConnection createConnection(URL url)
          Create an HttpURLConnection for the specified url.
 HttpResponse performRequest(Request<?> request, Map<String,String> additionalHeaders)
          Performs an HTTP request with the given parameters.
(package private) static void setConnectionParametersForRequest(HttpURLConnection connection, Request<?> request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HurlStack

public HurlStack()

HurlStack

public HurlStack(HurlStack.UrlRewriter urlRewriter)
Parameters:
urlRewriter - Rewriter to use for request URLs

HurlStack

public HurlStack(HurlStack.UrlRewriter urlRewriter,
                 SSLSocketFactory sslSocketFactory)
Parameters:
urlRewriter - Rewriter to use for request URLs
sslSocketFactory - SSL factory to use for HTTPS connections
Method Detail

performRequest

public HttpResponse performRequest(Request<?> request,
                                   Map<String,String> additionalHeaders)
                            throws IOException,
                                   AuthFailureError
Description copied from interface: HttpStack
Performs an HTTP request with the given parameters.

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().

Specified by:
performRequest in interface HttpStack
Parameters:
request - the request to perform
additionalHeaders - additional headers to be sent together with Request.getHeaders()
Returns:
the HTTP response
Throws:
IOException
AuthFailureError

createConnection

protected HttpURLConnection createConnection(URL url)
                                      throws IOException
Create an HttpURLConnection for the specified url.

Throws:
IOException

setConnectionParametersForRequest

static void setConnectionParametersForRequest(HttpURLConnection connection,
                                              Request<?> request)
                                       throws IOException,
                                              AuthFailureError
Throws:
IOException
AuthFailureError