com.flat502.rox.marshal.cgi
Class CgiRpcMethodCall

java.lang.Object
  extended by com.flat502.rox.marshal.cgi.CgiRpcMethodCall
All Implemented Interfaces:
RpcCall, RpcMethod

public class CgiRpcMethodCall
extends java.lang.Object
implements RpcCall


Constructor Summary
CgiRpcMethodCall(java.lang.String methodName, java.lang.Object[] parameters)
           
 
Method Summary
 java.lang.String getContentType()
          Called to get the value for the Content-Type HTTP header.
 java.lang.String getHttpMethod()
           
 java.lang.String getHttpURI(java.net.URL url)
          Map the destination URL onto a URI for use in an HTTP request.
 java.lang.String getName()
          Get the method name to invoke (or being invoked).
 java.lang.Object[] getParameters()
          Get a list of parameters to pass to (or that were passed to) this method call.
 void marshal(java.io.OutputStream out, java.nio.charset.Charset charSet)
          Marshal the current instance to an OutputStream encoded using the specified character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CgiRpcMethodCall

public CgiRpcMethodCall(java.lang.String methodName,
                        java.lang.Object[] parameters)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: RpcCall
Get the method name to invoke (or being invoked).

Specified by:
getName in interface RpcCall
Returns:
The name of the RPC method this instance represents.

getParameters

public java.lang.Object[] getParameters()
Description copied from interface: RpcCall
Get a list of parameters to pass to (or that were passed to) this method call.

Implementations must not return null. If no parameters exist a zero length array should be returned to simplify logic that depends on this method.

Specified by:
getParameters in interface RpcCall
Returns:
An array containing the parameters associated with this RPC method call. Never null.

getHttpMethod

public java.lang.String getHttpMethod()
Specified by:
getHttpMethod in interface RpcCall

getHttpURI

public java.lang.String getHttpURI(java.net.URL url)
Description copied from interface: RpcCall
Map the destination URL onto a URI for use in an HTTP request.

This method provides implementations with an opportunity to generate an appropriate URI (possibly tranformed) before the underlying HTTP request is contructed and sent.

Specified by:
getHttpURI in interface RpcCall
Parameters:
url - The URL the client making the call was directed at.
Returns:
A string value for use as the URI in an HTTP request that will represent this call.

getContentType

public java.lang.String getContentType()
Description copied from interface: RpcMethod
Called to get the value for the Content-Type HTTP header.

This is used when constructing requests and responses, and when validating requests and responses.

Specified by:
getContentType in interface RpcMethod
Returns:
An HTTP Content-Type string description without the charset attribute.

marshal

public void marshal(java.io.OutputStream out,
                    java.nio.charset.Charset charSet)
             throws java.io.IOException,
                    MarshallingException
Description copied from interface: RpcMethod
Marshal the current instance to an OutputStream encoded using the specified character set.

Implementations are free to ignore the character set but only if a character set has been agreed upon in advance by both sides.

Specified by:
marshal in interface RpcMethod
Parameters:
out - The OutputStream to marshal this instance to.
charSet - The character set to use when encoding the marshalled form of this instance. When this interface is invoked by an HttpRpcProcessor this is the value that will be sent as part of the Content-Type HTTP header.
Throws:
java.io.IOException - if an error occurs while storing the marshalled form of this instance out this instance.
MarshallingException - if an error occurs while marshalling this instance.