CONTENTS | PREV | NEXT | Java Remote Method Invocation |
As described in this section, the HTTP-based mechanism that the RMI transport layer uses for RMI calls only applies to firewalls with HTTP proxy servers.
java.rmi.server.RMISocketFactory
, which is the default
resource-provider for client and server sockets used to send and
receive RMI calls; this default socket factory can be obtained via
the
java.rmi.server.RMISocketFactory.getDefaultSocketFactory
method. This default socket factory creates sockets that
transparently provide the firewall tunnelling mechanism as follows:
java.net.NoRouteToHostException
or
a java.net.UnknownHostException
being thrown. If a
direct socket connection results in any other
java.io.IOException
being thrown, such as a
java.net.ConnectException
, the implementation may
attempt an HTTP connection.java.rmi.server.RMISocketFactory.createSocket
method.
Server-side sockets with this default behavior are provided by the
factory's
java.rmi.server.RMISocketFactory.createServerSocket
method.
java.rmi.server.disableHttp
property to
equal the boolean value true
.
Depending on the server's platform and network environment, this
information may or may not be available to the Java virtual machine
on which the server is running. If it is not available, the host's
fully qualified name must be specified with the property
java.rmi.server.hostname
when starting the server.
For example, use this command to start the RMI server class
ServerImpl
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 direction through a firewall, a client cannot export its own remote objects outside the firewall, because a host outside the firewall cannot initiate a method invocation back on the client.