Contains information that describes an HTTP response received by the SDK.
Public Constructor Summary
IncomingHttpResponse(HttpResponse response, String content)
Creates an
IncomingHttpResponse from a successful response and the content read
from it. |
|
IncomingHttpResponse(HttpResponseException e, HttpRequest request)
Creates an
IncomingHttpResponse from an HTTP error response. |
|
IncomingHttpResponse(HttpResponseException e, OutgoingHttpRequest request)
Creates an
IncomingHttpResponse from an HTTP error response. |
Public Method Summary
String |
getContent()
Returns the content of the response as a string.
|
Map<String, Object> |
getHeaders()
Returns the headers set on the response.
|
OutgoingHttpRequest |
getRequest()
Returns the request that resulted in this response.
|
int |
getStatusCode()
Returns the status code of the response.
|
Inherited Method Summary
Public Constructors
public IncomingHttpResponse (HttpResponse response, String content)
Creates an IncomingHttpResponse
from a successful response and the content read
from it. The caller is expected to read the content from the response, and handle any errors
that may occur while reading.
Parameters
response | A successful response. |
---|---|
content | Content read from the response. |
public IncomingHttpResponse (HttpResponseException e, HttpRequest request)
Creates an IncomingHttpResponse
from an HTTP error response.
Parameters
e | The exception representing the HTTP error response. |
---|---|
request | The request that resulted in the error. |
public IncomingHttpResponse (HttpResponseException e, OutgoingHttpRequest request)
Creates an IncomingHttpResponse
from an HTTP error response.
Parameters
e | The exception representing the HTTP error response. |
---|---|
request | The request that resulted in the error. |
Public Methods
public String getContent ()
Returns the content of the response as a string.
Returns
- HTTP content or null.
public Map<String, Object> getHeaders ()
Returns the headers set on the response.
Returns
- An immutable map of headers (possibly empty).
public OutgoingHttpRequest getRequest ()
Returns the request that resulted in this response.
Returns
- An HTTP request.
public int getStatusCode ()
Returns the status code of the response.
Returns
- An HTTP status code (e.g. 500).