play.libs.ws.ning
Class NingWSResponse

java.lang.Object
  extended by play.libs.ws.ning.NingWSResponse
All Implemented Interfaces:
WSResponse

public class NingWSResponse
extends java.lang.Object
implements WSResponse

A WS response.


Constructor Summary
NingWSResponse(com.ning.http.client.Response ahcResponse)
           
 
Method Summary
 byte[] asByteArray()
          Get the response body as a byte array
 com.fasterxml.jackson.databind.JsonNode asJson()
          Get the response body as a JsonNode
 org.w3c.dom.Document asXml()
          Get the response body as a DOM document
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllHeaders()
          Get all the HTTP headers of the response as a case-insensitive map
 java.lang.String getBody()
          Get the response body as a string.
 java.io.InputStream getBodyAsStream()
          Get the response body as a stream
 WSCookie getCookie(java.lang.String name)
          Get only one cookie, using the cookie name.
 java.util.List<WSCookie> getCookies()
          Get all the cookies.
 java.lang.String getHeader(java.lang.String key)
          Get the given HTTP header of the response
 int getStatus()
          Get the HTTP status code of the response
 java.lang.String getStatusText()
          Get the HTTP status text of the response
 java.lang.Object getUnderlying()
           
 java.net.URI getUri()
          Return the request URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NingWSResponse

public NingWSResponse(com.ning.http.client.Response ahcResponse)
Method Detail

getUnderlying

public java.lang.Object getUnderlying()
Specified by:
getUnderlying in interface WSResponse

getStatus

public int getStatus()
Get the HTTP status code of the response

Specified by:
getStatus in interface WSResponse

getStatusText

public java.lang.String getStatusText()
Get the HTTP status text of the response

Specified by:
getStatusText in interface WSResponse

getAllHeaders

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllHeaders()
Get all the HTTP headers of the response as a case-insensitive map

Specified by:
getAllHeaders in interface WSResponse

getHeader

public java.lang.String getHeader(java.lang.String key)
Get the given HTTP header of the response

Specified by:
getHeader in interface WSResponse

getCookies

public java.util.List<WSCookie> getCookies()
Get all the cookies.

Specified by:
getCookies in interface WSResponse

getCookie

public WSCookie getCookie(java.lang.String name)
Get only one cookie, using the cookie name.

Specified by:
getCookie in interface WSResponse

getBody

public java.lang.String getBody()
Get the response body as a string. If the charset is not specified, this defaults to ISO-8859-1 for text sub mime types, as per RFC-2616 sec 3.7.1, otherwise it defaults to UTF-8.

Specified by:
getBody in interface WSResponse

asXml

public org.w3c.dom.Document asXml()
Get the response body as a DOM document

Specified by:
asXml in interface WSResponse
Returns:
a DOM document

asJson

public com.fasterxml.jackson.databind.JsonNode asJson()
Get the response body as a JsonNode

Specified by:
asJson in interface WSResponse
Returns:
the json response

getBodyAsStream

public java.io.InputStream getBodyAsStream()
Get the response body as a stream

Specified by:
getBodyAsStream in interface WSResponse
Returns:
The stream to read the response body from

asByteArray

public byte[] asByteArray()
Get the response body as a byte array

Specified by:
asByteArray in interface WSResponse
Returns:
The byte array

getUri

public java.net.URI getUri()
Return the request URI. Note that if the request got redirected, the value of the URI will be the last valid redirect url.

Specified by:
getUri in interface WSResponse
Returns:
the request URI.