org.spicefactory.cinnamon.service
Class ServiceResponse

java.lang.Object
  extended by org.spicefactory.cinnamon.service.ServiceMessage
      extended by org.spicefactory.cinnamon.service.ServiceResponse
All Implemented Interfaces:
Externalizable

public class ServiceResponse
extends ServiceMessage

Represents a single service response. Encapsulates response headers and the return value of the service invocation. It is usually the only object sent in a Cinnamon AMF3 response.

Author:
Jens Halm

Constructor Summary
ServiceResponse()
          Creates a new ServiceResponse.
 
Method Summary
 Object getResult()
          Returns the result of the service invocation.
 boolean isComplete()
          Checks whether the result has already been set.
 void readExternal(DataInput in)
          Restores the content of this object from the DataInput instance.
 void setResult(Object result)
          Sets the result of the service invocation.
 void writeExternal(DataOutput out)
          Saves the content of this object to the DataOutput instance.
 
Methods inherited from class org.spicefactory.cinnamon.service.ServiceMessage
getHeaderNames, getHeaderValue, removeHeader, setHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceResponse

public ServiceResponse()
Creates a new ServiceResponse.

Method Detail

getResult

public Object getResult()
Returns the result of the service invocation. If the service invocation threw an Exception or if the service could not be invoked, the result is an instance of ErrorMessaga.

Returns:
the result of the service invocation

setResult

public void setResult(Object result)
Sets the result of the service invocation. Usually the result will be set by the framework automatically after service invocation. But alternatively this method could be used if you want to set the result in a ServiceInterceptor without even invoking the target method. This may be useful for caching or custom security logic for example.

Parameters:
result - the result of the service invocation

isComplete

public boolean isComplete()
Checks whether the result has already been set.

Returns:
true if the result has already been set

readExternal

public void readExternal(DataInput in)
Description copied from interface: Externalizable
Restores the content of this object from the DataInput instance. Values must be read in the same sequence as they were written on the client side.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class ServiceMessage
Parameters:
in - the AMF3 data to read from

writeExternal

public void writeExternal(DataOutput out)
Description copied from interface: Externalizable
Saves the content of this object to the DataOutput instance.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class ServiceMessage
Parameters:
out - the output to write to