Constructor and Description |
---|
HttpResponse(SdkHttpFullRequest request)
Constructs a new HttpResponse associated with the specified request.
|
HttpResponse(SdkHttpFullRequest request,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
void |
abort() |
void |
addHeader(String name,
String value)
Adds an HTTP header to the set associated with this response.
|
InputStream |
getContent()
Returns the input stream containing the response content.
|
String |
getHeader(String headerName)
Looks up a header by name and returns it's value.
|
Map<String,String> |
getHeaders()
Returns the HTTP headers returned with this response.
|
SdkHttpFullRequest |
getRequest()
Returns the original request associated with this response.
|
int |
getStatusCode()
Returns the HTTP status code (ex: 200, 404, etc) associated with this
response.
|
String |
getStatusText()
Returns the HTTP status text associated with this response.
|
boolean |
isSuccessful()
If we get back any 2xx status code, then we know we should treat the service call as successful.
|
void |
setContent(InputStream content)
Sets the input stream containing the response content.
|
void |
setStatusCode(int statusCode)
Sets the HTTP status code that was returned with this response.
|
void |
setStatusText(String statusText)
Sets the HTTP status text returned with this response.
|
public HttpResponse(SdkHttpFullRequest request)
request
- The associated request that generated this response.public HttpResponse(SdkHttpFullRequest request, Abortable abortable)
public SdkHttpFullRequest getRequest()
public Map<String,String> getHeaders()
public String getHeader(String headerName)
headerName
- Name of header to get value for.public void addHeader(String name, String value)
name
- The name of the HTTP header.value
- The value of the HTTP header.public InputStream getContent()
public void setContent(InputStream content)
content
- The input stream containing the response content.public String getStatusText()
public void setStatusText(String statusText)
statusText
- The HTTP status text (ex: "Not found") returned with this
response.public int getStatusCode()
public void setStatusCode(int statusCode)
statusCode
- The HTTP status code (ex: 200, 404, etc) associated with this
response.public boolean isSuccessful()
Copyright © 2018. All rights reserved.