All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.oreilly.servlet.RemoteHttpServlet

java.lang.Object
   |
   +----javax.servlet.GenericServlet
           |
           +----javax.servlet.http.HttpServlet
                   |
                   +----com.oreilly.servlet.RemoteHttpServlet

public abstract class RemoteHttpServlet
extends HttpServlet
implements Remote
A superclass for any HTTP servlet that wishes to act as an RMI server. RemoteHttpServlet begins listening for RMI calls in its init() method and stops listening in its destroy() method. To register itself it uses the registry on the local machine on the port determined by getRegistryPort(). It registers under the name determined by getRegistryName().

Version:
1.0, 98/09/18
Author:
Jason Hunter, Copyright © 1998
See Also:
RemoteDaemonHttpServlet

Variable Index

 o registry
The registry for the servlet

Constructor Index

 o RemoteHttpServlet()

Method Index

 o bind()
Binds the servlet to the registry.
 o destroy()
Halts the servlet's RMI operations.
 o getRegistryName()
Returns the name under which the servlet should be bound in the registry.
 o getRegistryPort()
Returns the port where the registry should be running.
 o init(ServletConfig)
Begins the servlet's RMI operations.
 o unbind()
Unbinds the servlet from the registry.

Variables

 o registry
 protected Registry registry
The registry for the servlet

Constructors

 o RemoteHttpServlet
 public RemoteHttpServlet()

Methods

 o init
 public void init(ServletConfig config) throws ServletException
Begins the servlet's RMI operations. Causes the servlet to export itself and then bind itself to the registry. Logs any errors. Subclasses that override this method must be sure to first call super.init(config).

Parameters:
config - the servlet config
Throws: ServletException
if a servlet exception occurs
Overrides:
init in class GenericServlet
 o destroy
 public void destroy()
Halts the servlet's RMI operations. Causes the servlet to unbind itself from the registry. Logs any errors. Subclasses that override this method must be sure to first call super.destroy().

Overrides:
destroy in class GenericServlet
 o getRegistryName
 protected String getRegistryName()
Returns the name under which the servlet should be bound in the registry. By default the name is the servlet's class name. This can be overridden with the registryName init parameter.

Returns:
the name under which the servlet should be bound in the registry
 o getRegistryPort
 protected int getRegistryPort()
Returns the port where the registry should be running. By default the port is the default registry port (1099). This can be overridden with the registryPort init parameter.

Returns:
the port for the registry
 o bind
 protected void bind()
Binds the servlet to the registry. Creates the registry if necessary. Logs any errors.

 o unbind
 protected void unbind()
Unbinds the servlet from the registry. Logs any errors.


All Packages  Class Hierarchy  This Package  Previous  Next  Index