com.duowan.mobile.netroid.stack
Class HurlStack

java.lang.Object
  extended by com.duowan.mobile.netroid.stack.HurlStack
All Implemented Interfaces:
HttpStack

public class HurlStack
extends java.lang.Object
implements HttpStack

An HttpStack based on HttpURLConnection.


Constructor Summary
HurlStack(java.lang.String userAgent)
           
HurlStack(java.lang.String userAgent, javax.net.ssl.SSLSocketFactory sslSocketFactory)
           
 
Method Summary
 org.apache.http.HttpResponse performRequest(Request<?> request)
          Performs an HTTP request with the given parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HurlStack

public HurlStack(java.lang.String userAgent,
                 javax.net.ssl.SSLSocketFactory sslSocketFactory)
Parameters:
sslSocketFactory - SSL factory to use for HTTPS connections

HurlStack

public HurlStack(java.lang.String userAgent)
Method Detail

performRequest

public org.apache.http.HttpResponse performRequest(Request<?> request)
                                            throws java.io.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
Returns:
the HTTP response
Throws:
java.io.IOException
AuthFailureError