public class HttpResponse extends Object
构造器和说明 |
---|
HttpResponse(Request<?> request,
org.apache.http.client.methods.HttpRequestBase httpRequest)
Constructs a new HttpResponse associated with the specified request.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
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.public Request<?> getRequest()
public org.apache.http.client.methods.HttpRequestBase getHttpRequest()
public Map<String,String> getHeaders()
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()
Copyright © 2016. All rights reserved.