Class Response
- java.lang.Object
-
- org.springframework.extensions.webscripts.connector.Response
-
public class Response extends java.lang.ObjectRepresentation of the response from a remote HTTP API call.- Author:
- Kevin Roast
-
-
Constructor Summary
Constructors Constructor Description Response(java.io.InputStream is, ResponseStatus status)Instantiates a new response.Response(java.lang.String data, ResponseStatus status)Instantiates a new response.Response(ResponseStatus status)Instantiates a new response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEncoding()Gets the encoding.java.lang.StringgetResponse()Gets the response.java.io.InputStreamgetResponseStream()Gets the response stream.ResponseStatusgetStatus()Gets the status.java.lang.StringgetText()Gets the text of the response.voidsetEncoding(java.lang.String encoding)Sets the encoding.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Response
public Response(ResponseStatus status)
Instantiates a new response.- Parameters:
status- the status
-
Response
public Response(java.lang.String data, ResponseStatus status)Instantiates a new response.- Parameters:
data- the datastatus- the status
-
Response
public Response(java.io.InputStream is, ResponseStatus status)Instantiates a new response.- Parameters:
is- the isstatus- the status
-
-
Method Detail
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding.- Parameters:
encoding- the new encoding
-
getResponse
public java.lang.String getResponse()
Gets the response.- Returns:
- the data stream from the response object - will be null on error or if the response has already been streamed to an OutputStream.
-
getText
public java.lang.String getText()
Gets the text of the response.- Returns:
- the text
-
getResponseStream
public java.io.InputStream getResponseStream()
Gets the response stream.- Returns:
- the response InputStream if set during construction, else will be null.
-
getStatus
public ResponseStatus getStatus()
Gets the status.- Returns:
- Status object representing the response status and any error information
-
getEncoding
public java.lang.String getEncoding()
Gets the encoding.- Returns:
- the response encoding
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-