m.c.m.proxyma.resource
Class ProxymaResponse

java.lang.Object
  extended by m.c.m.proxyma.resource.ProxymaResponse
Direct Known Subclasses:
ProxymaServletResponse

public abstract class ProxymaResponse
extends java.lang.Object

This is the "Adapter" abstract class that will be used by Proxyma to manage client responses.
Any concrete class that extends this one can be used by Proxyma to send Client responses. Through this class Proxyma can transparently handle "Servlet" or "Portlet" responses in the same way.

NOTE: this software is released under GPL License. See the LICENSE of this distribution for more informations.

Version:
$Id: ProxymaResponse.java 138 2010-06-20 13:53:32Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Constructor Summary
ProxymaResponse()
           
 
Method Summary
 ProxymaResponseDataBean getResponseData()
          Returns the ResponseDataBEan that countains all the data of the response.
 boolean hasBeenSent()
          Return the value of the already-sent flag.
abstract  int sendDataToClient()
          Serializes and sends the data of the response to the client.
 void sendingData()
          Sets the value of the already-sent flag to "true"
This method should be used by any implementation of "sendDataToClient" to declare the response as sent.
 void setResponseData(ProxymaResponseDataBean responseData)
          Set the new ResponseDataBean overwriting any previous value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxymaResponse

public ProxymaResponse()
Method Detail

setResponseData

public void setResponseData(ProxymaResponseDataBean responseData)
Set the new ResponseDataBean overwriting any previous value. In other words, this method changes the whole data of the response.
Note: if this attribute is null no data will be sent back to the client.

Parameters:
responseData - the new data for the response.
See Also:
ProxymaResponseDataBean

getResponseData

public ProxymaResponseDataBean getResponseData()
Returns the ResponseDataBEan that countains all the data of the response. This method is used by plugins, cache providers and serializers to perform their job over the data that will be sent back to the client.

Returns:
the bean countaining the response data.
See Also:
ProxymaResponseDataBean

hasBeenSent

public boolean hasBeenSent()
Return the value of the already-sent flag.
This method should be used by any implementation of "sendDataToClient" to check if the data has already been sent.

Returns:
true or false.

sendingData

public void sendingData()
Sets the value of the already-sent flag to "true"
This method should be used by any implementation of "sendDataToClient" to declare the response as sent.


sendDataToClient

public abstract int sendDataToClient()
                              throws java.lang.IllegalStateException,
                                     java.io.IOException
Serializes and sends the data of the response to the client.

NOTE: As soon as starts, any implementation of this method HAVE to check if the response has been already sent (using hasBeenSent() method) and rise an IllegalStateException if it returns "true".
If the response is not already sent, then the implementation HAVE run the sendingData() method before perform any job.

Returns:
an interger value that rappresents the exit status of the operations.
Throws:
java.lang.IllegalStateException - if the hasBeenSent method-call returns "true".
java.io.IOException


Copyright © 2010. All Rights Reserved.