Package play.libs.ws
Interface WSResponse
- All Superinterfaces:
play.libs.ws.StandaloneWSResponse
- All Known Implementing Classes:
AhcWSResponse
public interface WSResponse
extends play.libs.ws.StandaloneWSResponse
This is the WS response from the server.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Gets the body as an array of bytes.com.fasterxml.jackson.databind.JsonNodeasJson()Gets the body as JSON node.asXml()return the body as XML.Deprecated.getBody()<T> TgetBody(play.libs.ws.BodyReadable<T> readable) Gets the body of the response as a T, using aBodyReadable.Source<ByteString,?> Deprecated.Optional<play.libs.ws.WSCookie>List<play.libs.ws.WSCookie>getHeaderValues(String name) getSingleHeader(String name) intGets the underlying implementation response object, if any.Methods inherited from interface play.libs.ws.StandaloneWSResponse
getUri
-
Method Details
-
getHeaders
- Specified by:
getHeadersin interfaceplay.libs.ws.StandaloneWSResponse
-
getHeaderValues
- Specified by:
getHeaderValuesin interfaceplay.libs.ws.StandaloneWSResponse
-
getSingleHeader
- Specified by:
getSingleHeaderin interfaceplay.libs.ws.StandaloneWSResponse
-
getAllHeaders
Deprecated.Gets all the headers from the response. -
getUnderlying
Object getUnderlying()Gets the underlying implementation response object, if any.- Specified by:
getUnderlyingin interfaceplay.libs.ws.StandaloneWSResponse
-
getContentType
String getContentType()- Specified by:
getContentTypein interfaceplay.libs.ws.StandaloneWSResponse
-
getStatus
int getStatus()- Specified by:
getStatusin interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- the HTTP status code from the response.
-
getStatusText
String getStatusText()- Specified by:
getStatusTextin interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- the text associated with the status code.
-
getCookies
List<play.libs.ws.WSCookie> getCookies()- Specified by:
getCookiesin interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- all the cookies from the response.
-
getCookie
- Specified by:
getCookiein interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- a single cookie from the response, if any.
-
getBody
String getBody()- Specified by:
getBodyin interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- the body as a string.
-
getBodyAsBytes
ByteString getBodyAsBytes()- Specified by:
getBodyAsBytesin interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- the body as a ByteString
-
getBodyAsSource
Source<ByteString,?> getBodyAsSource()- Specified by:
getBodyAsSourcein interfaceplay.libs.ws.StandaloneWSResponse- Returns:
- the body as a Source
-
getBody
<T> T getBody(play.libs.ws.BodyReadable<T> readable) Gets the body of the response as a T, using aBodyReadable.See
WSBodyReadablesfor convenient functions.- Specified by:
getBodyin interfaceplay.libs.ws.StandaloneWSResponse- Type Parameters:
T- the type to return, i.e. String.- Parameters:
readable- a transformation function from a response to a T.- Returns:
- the body as an instance of T.
-
asXml
Document asXml()return the body as XML. -
asJson
com.fasterxml.jackson.databind.JsonNode asJson()Gets the body as JSON node.- Returns:
- json node.
-
getBodyAsStream
Deprecated.usegetBody(BodyReadable)withDefaultBodyReadables.inputStream().Gets the body as a stream. -
asByteArray
byte[] asByteArray()Gets the body as an array of bytes.
-
getBody(BodyReadable)withDefaultBodyReadables.inputStream().