Is there any way by which I can force RMI invocations to always tunnel via HTTP?

Christoph Dittberner

Firstly, you need to configure the call forwarder program running at a specific url (i.e./cgi-bin/java-rmi.cgi). To force http-tunneling you have to create a sun.rmi.transport.proxy.RMIHttpToCGISocketFactory as your default ClientSocketFactory and set it as

RMISocketFactory.setSocketFactory(new  sun.rmi.transport.proxy.RMIHttpToCGISocketFactory());
After that all RMI calls are encapuslated via a HTTP POST request and forwarded to the CGI program java-rmi.cgi which in turn "unwraps" the RMI call and forwards it to the appropriate remote object making the remote invocation.