Package play.libs.ws
Interface WSResponse
-
- All Superinterfaces:
play.libs.ws.StandaloneWSResponse
- All Known Implementing Classes:
AhcWSResponse
public interface WSResponse extends play.libs.ws.StandaloneWSResponseThis 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.JsonNodeasJson()Gets the body as JSON node.DocumentasXml()return the body as XML.Map<String,List<String>>getAllHeaders()Deprecated.StringgetBody()<T> TgetBody(play.libs.ws.BodyReadable<T> readable)Gets the body of the response as a T, using aBodyReadable.ByteStringgetBodyAsBytes()Source<ByteString,?>getBodyAsSource()InputStreamgetBodyAsStream()Deprecated.usegetBody(BodyReadable)withWSBodyWritables.inputStream().StringgetContentType()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)intgetStatus()StringgetStatusText()ObjectgetUnderlying()Gets the underlying implementation response object, if any.
-
-
-
Method Detail
-
getHeaders
Map<String,List<String>> getHeaders()
- Specified by:
getHeadersin interfaceplay.libs.ws.StandaloneWSResponse
-
getHeaderValues
List<String> getHeaderValues(String name)
- Specified by:
getHeaderValuesin interfaceplay.libs.ws.StandaloneWSResponse
-
getSingleHeader
Optional<String> getSingleHeader(String name)
- Specified by:
getSingleHeaderin 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:
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
Optional<play.libs.ws.WSCookie> getCookie(String name)
- 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 InputStream getBodyAsStream()
Deprecated.usegetBody(BodyReadable)withWSBodyWritables.inputStream().Gets the body as a stream.
-
asByteArray
byte[] asByteArray()
Gets the body as an array of bytes.
-
-