Package play.libs
Class WS.HttpResponse
- java.lang.Object
-
- play.libs.WS.HttpResponse
-
- Direct Known Subclasses:
WSAsync.HttpAsyncResponse,WSUrlFetch.HttpUrlfetchResponse
- Enclosing class:
- WS
public abstract static class WS.HttpResponse extends java.lang.ObjectAn HTTP response wrapper
-
-
Constructor Summary
Constructors Constructor Description HttpResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetContentType()The http response content typejava.lang.StringgetEncoding()abstract java.lang.StringgetHeader(java.lang.String key)abstract java.util.List<Http.Header>getHeaders()com.google.gson.JsonElementgetJson()get the response body as aJsonElementjava.util.Map<java.lang.String,java.lang.String>getQueryString()Parse the response string as a query string.abstract java.lang.IntegergetStatus()the HTTP status codeabstract java.lang.StringgetStatusText()The HTTP status textabstract java.io.InputStreamgetStream()get the response as a streamabstract java.lang.StringgetString()get the response body as a stringabstract java.lang.StringgetString(java.lang.String encoding)get the response body as a stringorg.w3c.dom.DocumentgetXml()Parse and get the response body as aDOM documentorg.w3c.dom.DocumentgetXml(boolean namespaceAware)Parse and get the response body as aDOM documentorg.w3c.dom.DocumentgetXml(java.lang.String encoding)parse and get the response body as aDOM documentorg.w3c.dom.DocumentgetXml(java.lang.String encoding, boolean namespaceAware)parse and get the response body as aDOM documentbooleansuccess()
-
-
-
Method Detail
-
getStatus
public abstract java.lang.Integer getStatus()
the HTTP status code- Returns:
- the status code of the http response
-
getStatusText
public abstract java.lang.String getStatusText()
The HTTP status text- Returns:
- the status text of the http response
-
success
public boolean success()
- Returns:
- true if the status code is 20x, false otherwise
-
getContentType
public java.lang.String getContentType()
The http response content type- Returns:
- the content type of the http response
-
getEncoding
public java.lang.String getEncoding()
-
getHeader
public abstract java.lang.String getHeader(java.lang.String key)
-
getHeaders
public abstract java.util.List<Http.Header> getHeaders()
-
getXml
public org.w3c.dom.Document getXml()
Parse and get the response body as aDOM document- Returns:
- a DOM document
-
getXml
public org.w3c.dom.Document getXml(boolean namespaceAware)
Parse and get the response body as aDOM document- Parameters:
namespaceAware- whether to output XML namespace information in the returned document- Returns:
- a DOM document
-
getXml
public org.w3c.dom.Document getXml(java.lang.String encoding)
parse and get the response body as aDOM document- Parameters:
encoding- xml charset encoding- Returns:
- a DOM document
-
getXml
public org.w3c.dom.Document getXml(java.lang.String encoding, boolean namespaceAware)parse and get the response body as aDOM document- Parameters:
encoding- xml charset encodingnamespaceAware- whether to output XML namespace information in the returned document- Returns:
- a DOM document
-
getString
public abstract java.lang.String getString()
get the response body as a string- Returns:
- the body of the http response
-
getString
public abstract java.lang.String getString(java.lang.String encoding)
get the response body as a string- Parameters:
encoding- string charset encoding- Returns:
- the body of the http response
-
getQueryString
public java.util.Map<java.lang.String,java.lang.String> getQueryString()
Parse the response string as a query string.- Returns:
- The parameters as a Map. Return an empty map if the response is not formed as a query string.
-
getStream
public abstract java.io.InputStream getStream()
get the response as a stream+ this method can only be called onced because async implementation does not allow it to be called + multiple times +
- Returns:
- an inputstream
-
getJson
public com.google.gson.JsonElement getJson()
get the response body as aJsonElement- Returns:
- the json response
-
-