MAX_BODY_DISPLAY_LENGTH| Constructor and Description |
|---|
DefaultResponse(org.apache.http.HttpResponse response,
long responseTime)
Constructor from apache HttpResponse.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asBytes()
The body of the response as a byte array, for dealing with binary data or
troubleshooting encoding issues.
|
com.fasterxml.jackson.databind.JsonNode |
asJson()
Returns the JSON response content as a JsonNode, or throws RuntimeMappingException.
|
String |
asText()
What was the content of the response?
|
Element |
asXml()
Returns the XML response content as an org.w3c.Element, or throws RuntimeMappingException.
|
void |
bigDump()
Prints the output of
Response.toString() to System.out, but without truncating the response body. |
void |
dump()
Prints the output of
Response.toString() to System.out. |
String |
getContent()
What was the content of the response?
|
Header |
getHeader(String headerName)
Get the value of an individual Header.
|
List<Header> |
getHeaders()
What headers did the server send?
|
List<Header> |
getHeaders(String headerName)
Get the all headers with the specified name.
|
long |
getResponseTime()
How long did the response take?
|
int |
getStatusCode()
What was the response code?
|
void |
tinyDump()
Prints the output of
Response.toCompactString() to System.out. |
String |
toBigString()
Returns the response headers and body, without truncating the body.
|
String |
toCompactString()
Returns the response as a compact single-line String.
|
String |
toString()
Returns the response headers and body, truncating the body.
|
public DefaultResponse(org.apache.http.HttpResponse response,
long responseTime)
response - the HttpResponseresponseTime - time taken for the request in millisecondspublic int getStatusCode()
ResponsegetStatusCode in interface Responsepublic String getContent()
ResponsegetContent in interface Responsepublic String asText()
Responsepublic List<Header> getHeaders()
ResponsegetHeaders in interface Responsepublic List<Header> getHeaders(String headerName)
ResponsegetHeaders in interface ResponseheaderName - The name of the headerpublic Header getHeader(String headerName)
ResponseResponse.getHeaders(String).public long getResponseTime()
ResponsegetResponseTime in interface Responsepublic com.fasterxml.jackson.databind.JsonNode asJson()
Responsepublic Element asXml()
Responsepublic String toString()
Responsepublic String toBigString()
ResponsetoBigString in interface Responsepublic String toCompactString()
ResponsetoCompactString in interface Responsepublic void tinyDump()
ResponseResponse.toCompactString() to System.out.public void dump()
ResponseResponse.toString() to System.out.public void bigDump()
ResponseResponse.toString() to System.out, but without truncating the response body. This could be a very large dump.Copyright © 2013. All Rights Reserved.