public class HurlStackConnection extends Object implements HttpConnection
HttpConnection implementation using HttpURLConnection.HttpConnection.RequestBodyDelegate| Constructor and Description |
|---|
HurlStackConnection(String method,
String url,
boolean followRedirects,
boolean useCaches,
int connectTimeout,
int readTimeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection and frees all the allocated resources.
|
ServerResponse |
getResponse(HttpConnection.RequestBodyDelegate delegate)
Gets the server response.
|
HttpConnection |
setHeaders(List<NameValue> requestHeaders)
Set request headers.
|
HttpConnection |
setTotalBodyBytes(long totalBodyBytes,
boolean isFixedLengthStreamingMode)
Sets the total body bytes.
|
public HurlStackConnection(String method, String url, boolean followRedirects, boolean useCaches, int connectTimeout, int readTimeout) throws IOException
IOExceptionpublic HttpConnection setHeaders(List<NameValue> requestHeaders) throws IOException
HttpConnectionsetHeaders in interface HttpConnectionrequestHeaders - request headers to setIOException - if an error occurs while setting request headerspublic HttpConnection setTotalBodyBytes(long totalBodyBytes, boolean isFixedLengthStreamingMode)
HttpConnectionsetTotalBodyBytes in interface HttpConnectiontotalBodyBytes - total number of bytesisFixedLengthStreamingMode - true if the fixed length streaming mode must be used. If
it's false, chunked streaming mode has to be usedpublic ServerResponse getResponse(HttpConnection.RequestBodyDelegate delegate) throws IOException
HttpConnectiongetResponse in interface HttpConnectiondelegate - delegate which handles the writing of the request bodyIOException - if an error occurs while getting the server responsepublic void close()
HttpConnectionclose in interface HttpConnection