public class HttpResponse extends Object
Constructor and Description |
---|
HttpResponse(Request<?> request,
org.apache.http.client.methods.HttpRequestBase httpRequest)
Constructs a new HttpResponse associated with the specified request.
|
HttpResponse(Request<?> request,
org.apache.http.client.methods.HttpRequestBase httpRequest,
org.apache.http.protocol.HttpContext context) |
Modifier and Type | Method and Description |
---|---|
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.
|
long |
getCRC32Checksum()
Returns the CRC32 checksum calculated by the underlying CRC32ChecksumCalculatingInputStream.
|
String |
getHeader(String headerName)
Looks up a header by name and returns its value.
|
Map<String,String> |
getHeaders()
Returns the HTTP headers returned with this response.
|
org.apache.http.client.methods.HttpRequestBase |
getHttpRequest()
Returns the original http request associated with this response.
|
Request<?> |
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.
|
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(Request<?> request, org.apache.http.client.methods.HttpRequestBase httpRequest)
request
- The associated request that generated this response.httpRequest
- The underlying http request that generated this response.IOException
public HttpResponse(Request<?> request, org.apache.http.client.methods.HttpRequestBase httpRequest, org.apache.http.protocol.HttpContext context)
public Request<?> getRequest()
public org.apache.http.client.methods.HttpRequestBase getHttpRequest()
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 void setContent(InputStream content)
content
- The input stream containing the response content.public InputStream getContent()
public void setStatusText(String statusText)
statusText
- The HTTP status text (ex: "Not found") returned with this
response.public String getStatusText()
public void setStatusCode(int statusCode)
statusCode
- The HTTP status code (ex: 200, 404, etc) associated with this
response.public int getStatusCode()
public long getCRC32Checksum()
Copyright © 2017. All rights reserved.