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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description byte[]
asByteArray()
Gets the body as an array of bytes.com.fasterxml.jackson.databind.JsonNode
asJson()
Gets the body as JSON node.Document
asXml()
return the body as XML.Map<String,List<String>>
getAllHeaders()
Deprecated.String
getBody()
<T> T
getBody(play.libs.ws.BodyReadable<T> readable)
Gets the body of the response as a T, using aBodyReadable
.ByteString
getBodyAsBytes()
Source<ByteString,?>
getBodyAsSource()
InputStream
getBodyAsStream()
Deprecated.usegetBody(BodyReadable)
withWSBodyWritables.inputStream()
.String
getContentType()
Optional<play.libs.ws.WSCookie>
getCookie(String name)
List<play.libs.ws.WSCookie>
getCookies()
Map<String,List<String>>
getHeaders()
List<String>
getHeaderValues(String name)
Optional<String>
getSingleHeader(String name)
int
getStatus()
String
getStatusText()
Object
getUnderlying()
Gets the underlying implementation response object, if any.
-
-
-
Method Detail
-
getHeaders
Map<String,List<String>> getHeaders()
- Specified by:
getHeaders
in interfaceplay.libs.ws.StandaloneWSResponse
-
getHeaderValues
List<String> getHeaderValues(String name)
- Specified by:
getHeaderValues
in interfaceplay.libs.ws.StandaloneWSResponse
-
getSingleHeader
Optional<String> getSingleHeader(String name)
- Specified by:
getSingleHeader
in interfaceplay.libs.ws.StandaloneWSResponse
-
getAllHeaders
@Deprecated Map<String,List<String>> getAllHeaders()
Deprecated.Gets all the headers from the response.
-
getUnderlying
Object getUnderlying()
Gets the underlying implementation response object, if any.- Specified by:
getUnderlying
in interfaceplay.libs.ws.StandaloneWSResponse
-
getContentType
String getContentType()
- Specified by:
getContentType
in interfaceplay.libs.ws.StandaloneWSResponse
-
getStatus
int getStatus()
- Specified by:
getStatus
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- the HTTP status code from the response.
-
getStatusText
String getStatusText()
- Specified by:
getStatusText
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- the text associated with the status code.
-
getCookies
List<play.libs.ws.WSCookie> getCookies()
- Specified by:
getCookies
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- all the cookies from the response.
-
getCookie
Optional<play.libs.ws.WSCookie> getCookie(String name)
- Specified by:
getCookie
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- a single cookie from the response, if any.
-
getBody
String getBody()
- Specified by:
getBody
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- the body as a string.
-
getBodyAsBytes
ByteString getBodyAsBytes()
- Specified by:
getBodyAsBytes
in interfaceplay.libs.ws.StandaloneWSResponse
- Returns:
- the body as a ByteString
-
getBodyAsSource
Source<ByteString,?> getBodyAsSource()
- Specified by:
getBodyAsSource
in 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
WSBodyReadables
for convenient functions.- Specified by:
getBody
in 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 InputStream getBodyAsStream()
Deprecated.usegetBody(BodyReadable)
withWSBodyWritables.inputStream()
.Gets the body as a stream.
-
asByteArray
byte[] asByteArray()
Gets the body as an array of bytes.
-
-