com.pushtotest.tool.response
Interface Response

All Known Implementing Classes:
FileResponse, HTTPResponse, MailResponse, ResponseWrapper, SOAPResponse, XMLRPCResponse

public interface Response

This is the Response interface that should be implemented by any protocol specific response version.


Method Summary
 void appendParameter(java.lang.String name, java.lang.Object value)
          This method appends an Object to a parameter that is already stored or creates a new parameter if name is not used already.
 void appendParameters(java.lang.String name, java.util.List values)
          This method appends a List of Objects to a parameter that is already stored or creates a new parameter if name is not used already.
 java.lang.Object getContent()
          This method returns the entire contents that comprised the response that was sent back from the server.
 long getDataTime()
          Returns the time it took from making the request to the host to when all the response data is saved to the response object.
 java.util.Iterator getParameterKeys()
          Returns an Iterator of all of the parameter values so that they user can get the list and then get the values.
 java.lang.Object getParameterValue(java.lang.String name)
          Returns a single value that is associated with the name given.
 java.util.List getParameterValues(java.lang.String name)
          Returns the values associated with this parameter as a List.
 Protocol getParentProtocol()
          Returns the Protocol that was called that generated this Response object.
 int getResponseCode()
          Returns the response code value received from the host
 java.lang.String getResponseMessage()
          Returns the response code message.
 long getSetupTime()
          Returns the amount of time it took to set-up the request but does not include the time to make the request or receive the response.
 long getTotalTime()
          Returns the total time it took to set-up the request, communicate with the host, and save the response data to a response object.
 java.lang.String id()
          Gets the id of this response object.
 void setContent(java.lang.Object content)
          This method sets the content of this response.
 void setDataTime(long millis)
          Sets the time it took from making the request to the host to when all the response data is saved to the response object.
 void setParameter(java.lang.String name, java.lang.Object value)
          This method stores something in this response to be used later by a process.
 void setParameters(java.lang.String name, java.util.List values)
          Sets a List of parameters to be stored with the associated name.
 void setParentProtocol(Protocol parent)
          Sets the parent protocol of this Response object.
 void setResponseCode(int thecode)
          Sets the response code value, used internally
 void setResponseMessage(java.lang.String rmsg)
          Sets the response code message.
 void setSetupTime(long millis)
          Sets the amount of time it took to set-up the request but does not include the time to make the request or receive the response.
 void setTotalTime(long millis)
          Sets the total time it took to connect to the host, make the request and get all of the data back.
 java.lang.String toString()
          Returns a string representation of all of the content that was returned from the server that made up this Response.
 

Method Detail

id

java.lang.String id()
Gets the id of this response object. This id should correspond to the id that is used by the Protocol object used to get this response type.

Returns:
The name of the protocol that this response is from.

getParentProtocol

Protocol getParentProtocol()
Returns the Protocol that was called that generated this Response object.

Returns:
The Protocol that was used to get this Response.

setResponseCode

void setResponseCode(int thecode)
Sets the response code value, used internally

Parameters:
String - responsecode

getResponseCode

int getResponseCode()
Returns the response code value received from the host

Returns:
String responsecode received

getResponseMessage

java.lang.String getResponseMessage()
Returns the response code message. For example: HTTP/1.0 200 OK


setResponseMessage

void setResponseMessage(java.lang.String rmsg)
Sets the response code message. For example: HTTP/1.0 200 OK


setParentProtocol

void setParentProtocol(Protocol parent)
                       throws UnsupportedTypeException
Sets the parent protocol of this Response object. This allows for 'bi-directionality'.

Parameters:
parent - The Protocol that caused this Response to be returned.
Throws:
UnsupportedTypeException - If for some reason the Parent type and the the Response type are incompatible.

getContent

java.lang.Object getContent()
This method returns the entire contents that comprised the response that was sent back from the server.

Returns:
The content as a String.

setContent

void setContent(java.lang.Object content)
This method sets the content of this response.

Parameters:
content - The content as a String.

toString

java.lang.String toString()
Returns a string representation of all of the content that was returned from the server that made up this Response.

Overrides:
toString in class java.lang.Object
Returns:
The content that was returned from the server.

setTotalTime

void setTotalTime(long millis)
Sets the total time it took to connect to the host, make the request and get all of the data back.

Parameters:
millis - The time it took to do the whole connection.

getTotalTime

long getTotalTime()
Returns the total time it took to set-up the request, communicate with the host, and save the response data to a response object.

Returns:
The total time it took to do the whole connection.

setDataTime

void setDataTime(long millis)
Sets the time it took from making the request to the host to when all the response data is saved to the response object.

Parameters:
millis - The time to get the data back from the host.

getDataTime

long getDataTime()
Returns the time it took from making the request to the host to when all the response data is saved to the response object.

Returns:
The time to get the data back from the host.

setSetupTime

void setSetupTime(long millis)
Sets the amount of time it took to set-up the request but does not include the time to make the request or receive the response.

Parameters:
millis - The amount of time it takes to connect and send the request.

getSetupTime

long getSetupTime()
Returns the amount of time it took to set-up the request but does not include the time to make the request or receive the response.

Returns:
The amount of time it takes to connect and send the request.

setParameter

void setParameter(java.lang.String name,
                  java.lang.Object value)
This method stores something in this response to be used later by a process. This method replaces an Object that is stored with name if one already exists.

Parameters:
name - The name to store this as.
value - The object to associate with this name.

setParameters

void setParameters(java.lang.String name,
                   java.util.List values)
Sets a List of parameters to be stored with the associated name. This is to handle 'multi-valued' parameters. Geoff 10/24/2001: Is storing generic objects ok? Will anyone know what to do with them later?

Parameters:
name - The name of the parameter.
values - The objects to associate with this param.

appendParameter

void appendParameter(java.lang.String name,
                     java.lang.Object value)
This method appends an Object to a parameter that is already stored or creates a new parameter if name is not used already.

Parameters:
name - The name of the parameter.
value - The object to associate with this param.

appendParameters

void appendParameters(java.lang.String name,
                      java.util.List values)
This method appends a List of Objects to a parameter that is already stored or creates a new parameter if name is not used already.

Parameters:
name - The name of the parameter.
values - The objects to associate with this param.

getParameterKeys

java.util.Iterator getParameterKeys()
Returns an Iterator of all of the parameter values so that they user can get the list and then get the values.

Returns:
An Iterator to iterate over to get all of the values.

getParameterValue

java.lang.Object getParameterValue(java.lang.String name)
Returns a single value that is associated with the name given. If the parameter is a multi-valued one, it will just return a value, with no guarantee as to which position it is in. If you know that it is a multi-valued, you should use the getParameterValues call instead.

Parameters:
name - The name of the parameter to get the value for.
See Also:
getParameterValues(java.lang.String)

getParameterValues

java.util.List getParameterValues(java.lang.String name)
Returns the values associated with this parameter as a List.

Parameters:
name - The name of the parameter to get the value for.