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.
|
Map<String,List<String>> |
getAllHeaders()
Returns all of the HTTP headers returned 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)
Deprecated.
|
Map<String,String> |
getHeaders()
Deprecated.
|
List<String> |
getHeaderValues(String header)
Returns all the values for a given header name.
|
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()
HttpResponse.getAllHeaders()
public Map<String,List<String>> getAllHeaders()
HttpResponse.getHeaders()
, this returns all values returned with the
same field-name, rather than the last seen value.public List<String> getHeaderValues(String header)
header
- The header name.public String getHeader(String headerName)
HttpResponse.getHeaderValues(String)
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 © 2024. All rights reserved.