com.nativex.common
Class Response

java.lang.Object
  extended by com.nativex.common.Response
Direct Known Subclasses:
GetImageResponse

public class Response
extends Object

A simple response object to be used with ServerResponseHandler.

Author:
Anton Donchev

Nested Class Summary
protected static class Response.TYPE
           
 
Field Summary
private  String response
           
private  Response.TYPE responseType
           
private  String status
           
private  int statusCode
           
private  String url
           
 
Constructor Summary
Response()
          Simple constructor.
Response(int statusCode, String status, InputStream inputStream)
          Constructor that receives the response parameters.
 
Method Summary
private  String convertInputStreamToString(InputStream inputStream)
          Converts the InputStream received from the server to String.
 String getPrettyResponse()
          Prettifies the response body for debugging output.
 String getResponse()
          Returns the response.
protected  Response.TYPE getResponseType()
          Gets the response type.
 String getStatus()
          Returns the response status.
 int getStatusCode()
          Returns the HTTP connection status code.
 String getUrl()
          Returns the request URL.
protected  void setRawResponse(String response)
          Sets the value of the response field directly.
 void setResponse(InputStream inputStream)
          Sets the response.
protected  void setResponseType(Response.TYPE type)
          Sets the response type
 void setStatus(String status)
          Sets the response status.
 void setStatusCode(int statusCode)
          Sets the HTTP connection status code.
 void setUrl(String url)
          Sets the request URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statusCode

private int statusCode

response

private String response

url

private String url

responseType

private Response.TYPE responseType

status

private String status
Constructor Detail

Response

public Response()
Simple constructor.


Response

public Response(int statusCode,
                String status,
                InputStream inputStream)
Constructor that receives the response parameters.

Parameters:
statusCode - R.integer. The status code of the HTTP connection.
status - String. A description of the Response status.
inputStream - InputStream. The response from the server.
Method Detail

getResponse

public String getResponse()
Returns the response.

Returns:
String. The response from the server.

getPrettyResponse

public String getPrettyResponse()
Prettifies the response body for debugging output.

Returns:
String The response body, only prettier.

convertInputStreamToString

private String convertInputStreamToString(InputStream inputStream)
Converts the InputStream received from the server to String.

Returns:
String. The response as String.

setResponse

public void setResponse(InputStream inputStream)
Sets the response.

Parameters:
inputStream - InputStream. The response from the server to decode.

setRawResponse

protected void setRawResponse(String response)
Sets the value of the response field directly.

Parameters:
inputStream - String. The response as String.

getStatusCode

public int getStatusCode()
Returns the HTTP connection status code.

Returns:
R.integer. The status code.

setStatusCode

public void setStatusCode(int statusCode)
Sets the HTTP connection status code.

Parameters:
statusCode - R.integer. The status code.

setUrl

public void setUrl(String url)
Sets the request URL.

Parameters:
url - String. The URL of the request.

getUrl

public String getUrl()
Returns the request URL.

Returns:
String. The request URL.

setResponseType

protected void setResponseType(Response.TYPE type)
Sets the response type

Parameters:
type - Response.TYPE. The respose type.

getResponseType

protected Response.TYPE getResponseType()
Gets the response type.

Returns:
Response.TYPE. The response type.

getStatus

public String getStatus()
Returns the response status.

Returns:
String. The status.

setStatus

public void setStatus(String status)
Sets the response status.

Parameters:
status -