com.distinct.rpc
Class ClientHTTP

java.lang.Object
  |
  +--com.distinct.rpc.ClientGeneric
        |
        +--com.distinct.rpc.ClientHTTP
All Implemented Interfaces:
java.io.Serializable

public class ClientHTTP
extends ClientGeneric

Implementation of the RPC protocol via HTTP.

See Also:
ClientGeneric, Serialized Form

Constructor Summary
ClientHTTP(java.lang.String rpcgw_url, java.lang.String rpchost, int prog, int vers, boolean stream)
          Creates a new HTTP protocol object.
ClientHTTP(java.lang.String host, java.lang.String gateway, java.lang.String rpchost, int prog, int vers, boolean stream)
          Creates a new HTTP protocol object.
 
Method Summary
 void Call(int prog, int vers, int proc, XDRType in, XDRType out)
          Calls the server.
 void close()
          Closes the connection and frees the socket resource.
 void setResend(int milliseconds)
          Changes the timeout value for retransmission of the request (no function for TCP).
 void setTimeout(int timeout)
          Changes the timeout value for waiting on server replies (default is 25s).
 
Methods inherited from class com.distinct.rpc.ClientGeneric
Call, getReturnedVerifier, setCredential, setVerifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientHTTP

public ClientHTTP(java.lang.String host,
                  java.lang.String gateway,
                  java.lang.String rpchost,
                  int prog,
                  int vers,
                  boolean stream)
           throws RPCError,
                  java.io.IOException
Creates a new HTTP protocol object. Requires the "rpcgw" CGI-script on the server to perform the real call.

Parameters:
host - The hostname of the node on which the HTTP-server lives.
gateway - The filename of the "rpcgw" CGI-script that translates the HTTP request into an RPC call.
rpchost - The name of the host on which the real RPC server lives.
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
stream - true for a TCP connection, false for UDP.
Throws:
RPCError - When the port can not be found in the portmapper (perhaps there is even no portmapper running).
java.io.IOException - When the socket could not be opened.

ClientHTTP

public ClientHTTP(java.lang.String rpcgw_url,
                  java.lang.String rpchost,
                  int prog,
                  int vers,
                  boolean stream)
           throws RPCError,
                  java.io.IOException
Creates a new HTTP protocol object. Requires the "rpcgw" CGI-script on the server to perform the real call.

Parameters:
rpchost - The name of the host on which the real RPC server lives.
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
stream - true for a TCP connection, false for UDP.
Throws:
RPCError - When the port can not be found in the portmapper (perhaps there is even no portmapper running).
java.io.IOException - When the socket could not be opened.
Method Detail

Call

public void Call(int prog,
                 int vers,
                 int proc,
                 XDRType in,
                 XDRType out)
          throws RPCError,
                 java.io.IOException
Calls the server.

Specified by:
Call in class ClientGeneric
Parameters:
prog - The program ID of the server as defined in the .x IDL file.
vers - The program version of the server as defined in the .x IDL file.
proc - The ID of the request function as defined in the .x IDL file.
in - The input parameter (as it has to be marshalled it must be derived from XDRType).
out - The output parameter (as it has to be marshalled it must be derived from XDRType).
Throws:
java.io.IOException - When the call fails because the socket connetion fails.
RPCError - When the calls fails for any other reason.

close

public void close()
Closes the connection and frees the socket resource.

Specified by:
close in class ClientGeneric

setTimeout

public void setTimeout(int timeout)
Changes the timeout value for waiting on server replies (default is 25s).

Specified by:
setTimeout in class ClientGeneric
Parameters:
timeout - The new timeout value (0 means not timeout at all).

setResend

public void setResend(int milliseconds)
Changes the timeout value for retransmission of the request (no function for TCP).

Specified by:
setResend in class ClientGeneric
Parameters:
milliseconds - The new timeout value in ms.