Package play.libs.ws.ahc
Class AhcWSResponse
- Object
-
- play.libs.ws.ahc.AhcWSResponse
-
- All Implemented Interfaces:
play.libs.ws.StandaloneWSResponse,WSResponse
public class AhcWSResponse extends Object implements WSResponse
A Play WS response backed by an AsyncHttpClient response.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description byte[]asByteArray()Deprecated.Useresponse.getBodyAsBytes().toArray()com.fasterxml.jackson.databind.JsonNodeasJson()Deprecated.Useresponse.getBody(json())DocumentasXml()Deprecated.Useresponse.getBody(xml())Map<String,List<String>>getAllHeaders()Deprecated.Deprecated since 2.6.0.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.Useresponse.getBody(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.URIgetUri()
-
-
-
Method Detail
-
getHeaders
public Map<String,List<String>> getHeaders()
- Specified by:
getHeadersin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getHeadersin interfaceWSResponse
-
getHeaderValues
public List<String> getHeaderValues(String name)
- Specified by:
getHeaderValuesin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getHeaderValuesin interfaceWSResponse
-
getSingleHeader
public Optional<String> getSingleHeader(String name)
- Specified by:
getSingleHeaderin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getSingleHeaderin interfaceWSResponse
-
getUnderlying
public Object getUnderlying()
Description copied from interface:WSResponseGets the underlying implementation response object, if any.- Specified by:
getUnderlyingin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getUnderlyingin interfaceWSResponse
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getContentTypein interfaceWSResponse
-
getStatus
public int getStatus()
- Specified by:
getStatusin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getStatusin interfaceWSResponse- Returns:
- the HTTP status code from the response.
-
getStatusText
public String getStatusText()
- Specified by:
getStatusTextin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getStatusTextin interfaceWSResponse- Returns:
- the text associated with the status code.
-
getCookies
public List<play.libs.ws.WSCookie> getCookies()
- Specified by:
getCookiesin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getCookiesin interfaceWSResponse- Returns:
- all the cookies from the response.
-
getCookie
public Optional<play.libs.ws.WSCookie> getCookie(String name)
- Specified by:
getCookiein interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getCookiein interfaceWSResponse- Returns:
- a single cookie from the response, if any.
-
getBodyAsBytes
public ByteString getBodyAsBytes()
- Specified by:
getBodyAsBytesin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getBodyAsBytesin interfaceWSResponse- Returns:
- the body as a ByteString
-
getBody
public <T> T getBody(play.libs.ws.BodyReadable<T> readable)
Description copied from interface:WSResponseGets the body of the response as a T, using aBodyReadable.See
WSBodyReadablesfor convenient functions.- Specified by:
getBodyin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getBodyin interfaceWSResponse- 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.
-
getBodyAsSource
public Source<ByteString,?> getBodyAsSource()
- Specified by:
getBodyAsSourcein interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getBodyAsSourcein interfaceWSResponse- Returns:
- the body as a Source
-
getBody
public String getBody()
- Specified by:
getBodyin interfaceplay.libs.ws.StandaloneWSResponse- Specified by:
getBodyin interfaceWSResponse- Returns:
- the body as a string.
-
getUri
public URI getUri()
- Specified by:
getUriin interfaceplay.libs.ws.StandaloneWSResponse
-
getAllHeaders
@Deprecated public Map<String,List<String>> getAllHeaders()
Deprecated.Deprecated since 2.6.0. UsegetHeaders()instead.Description copied from interface:WSResponseGets all the headers from the response.- Specified by:
getAllHeadersin interfaceWSResponse- Returns:
- the headers
-
asXml
@Deprecated public Document asXml()
Deprecated.Useresponse.getBody(xml())Description copied from interface:WSResponsereturn the body as XML.- Specified by:
asXmlin interfaceWSResponse
-
asJson
@Deprecated public com.fasterxml.jackson.databind.JsonNode asJson()
Deprecated.Useresponse.getBody(json())Description copied from interface:WSResponseGets the body as JSON node.- Specified by:
asJsonin interfaceWSResponse- Returns:
- json node.
-
getBodyAsStream
@Deprecated public InputStream getBodyAsStream()
Deprecated.Useresponse.getBody(inputStream())Description copied from interface:WSResponseGets the body as a stream.- Specified by:
getBodyAsStreamin interfaceWSResponse
-
asByteArray
@Deprecated public byte[] asByteArray()
Deprecated.Useresponse.getBodyAsBytes().toArray()Description copied from interface:WSResponseGets the body as an array of bytes.- Specified by:
asByteArrayin interfaceWSResponse
-
-