org.aludratest.hpalm.infrastructure
Class Response

java.lang.Object
  extended by org.aludratest.hpalm.infrastructure.Response

public class Response
extends Object

This is a naive implementation of an HTTP response. We use it to simplify matters in the examples. It is nothing more than a container of the response headers and the response body.


Constructor Summary
Response()
           
Response(Map<String,Iterable<String>> responseHeaders, byte[] responseData, Exception failure, int statusCode)
           
 
Method Summary
 Exception getFailure()
           
 byte[] getResponseData()
           
 Map<String,? extends Iterable<String>> getResponseHeaders()
           
 int getStatusCode()
           
 void setFailure(Exception failure)
           
 void setResponseData(byte[] responseData)
           
 void setResponseHeaders(Map<String,? extends Iterable<String>> responseHeaders)
           
 void setStatusCode(int statusCode)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

public Response(Map<String,Iterable<String>> responseHeaders,
                byte[] responseData,
                Exception failure,
                int statusCode)

Response

public Response()
Method Detail

getResponseHeaders

public Map<String,? extends Iterable<String>> getResponseHeaders()
Returns:
the responseHeaders

setResponseHeaders

public void setResponseHeaders(Map<String,? extends Iterable<String>> responseHeaders)
Parameters:
responseHeaders - the responseHeaders to set

getResponseData

public byte[] getResponseData()
Returns:
the responseData

setResponseData

public void setResponseData(byte[] responseData)
Parameters:
responseData - the responseData to set

getFailure

public Exception getFailure()
Returns:
the failure if the access to the requested URL failed, such as a 404 or 500. If no such failure occured this method returns null.

setFailure

public void setFailure(Exception failure)
Parameters:
failure - the failure to set

getStatusCode

public int getStatusCode()
Returns:
the statusCode

setStatusCode

public void setStatusCode(int statusCode)
Parameters:
statusCode - the statusCode to set

toString

public String toString()
Overrides:
toString in class Object
See Also:
return the contents of the byte[] data as a string.


Copyright © 2015 aludratest.org. All rights reserved.