| CONTENTS |PREV |NEXT | Java Remote Method Invocation |
As described in thissection, the HTTP-based mechanism that the RMI transport layer usesfor RMI calls only applies to firewalls with HTTP proxyservers.
java.rmi.server.RMISocketFactory, which is the defaultresource-provider for client and server sockets used to send andreceive RMI calls; this default socket factory can be obtained viathejava.rmi.server.RMISocketFactory.getDefaultSocketFactorymethod. This default socket factory creates sockets thattransparently provide the firewall tunnelling mechanism as follows:java.net.NoRouteToHostException orajava.net.UnknownHostException being thrown. If adirect socket connection results in any otherjava.io.IOException being thrown, such as ajava.net.ConnectException, the implementation mayattempt an HTTP connection.java.rmi.server.RMISocketFactory.createSocket method.Server-side sockets with this default behavior are provided by thefactory'sjava.rmi.server.RMISocketFactory.createServerSocketmethod.java.rmi.server.disableHttp property toequal the boolean valuetrue.Depending on the server's platform and network environment, thisinformation may or may not be available to the Java virtual machineon which the server is running. If it is not available, the host'sfully qualified name must be specified with the propertyjava.rmi.server.hostname when starting the server.
For example, use this command to start the RMI server classServerImpl on the machine chatsubo.example.com:
java -Djava.rmi.server.hostname=chatsubo.example.com ServerImpl
/cgi-bin/java-rmi.cgiThis script:
Because HTTP requests can only be initiated in one directionthrough a firewall, a client cannot export its own remote objectsoutside the firewall, because a host outside the firewall cannotinitiate a method invocation back on the client.