All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.hdf.server.HDFServer

java.lang.Object
   |
   +----javax.servlet.GenericServlet
           |
           +----javax.servlet.http.HttpServlet
                   |
                   +----ncsa.hdf.server.FileServlet
                           |
                           +----ncsa.hdf.server.HDFServer

public class HDFServer
extends FileServlet
implements Runnable
DHFServer sets up a server with the specified port and document root. The server can be a stand-alone java application at whitch the main() function will be called to start the server thread. All HDF requests will be handled in class HDFServerConnection. The server can be also an HttpServlet, in which case, the init() method will be called to setup the server document root when the servlet is invoked by the first time. All the HDF requests will be handled in the service() method of the servlet.

See Also:
FileServlet

Variable Index

 o debug
debug flag
 o documentDir
The document root directory for serving files.
 o mainSocket
the HDFServer main ServerSocket
 o port
the HDFServer port number
 o serverThread
the main server thread

Constructor Index

 o HDFServer()
Creates a new HDFServer without a ServerSocket
 o HDFServer(int, String)
Creates a new HDFServer with specified document root directory and local port number which the ServerSocket is bonded on

Method Index

 o doGet(HttpServletRequest, HttpServletResponse)
sends back an error message because HDF files can not be viewed from a regular browser for the current version of HDFServer.
 o doPost(HttpServletRequest, HttpServletResponse)
takes an HDF request from the received HDFMessage and sends back an HDF response by an HDFMessage through ObjectOutputStream
 o getDocRoot()
return the document root of the server
 o init(ServletConfig)
overwrite HttpServlet.
 o main(String[])
The main() function sets up and runs the HDFServer.
 o run()
overwirte Thread.
 o service(HttpServletRequest, HttpServletResponse)
overwrites FileServlet.

Variables

 o debug
 public static boolean debug
debug flag

 o documentDir
 protected String documentDir
The document root directory for serving files.

 o port
 protected int port
the HDFServer port number

 o mainSocket
 protected ServerSocket mainSocket
the HDFServer main ServerSocket

 o serverThread
 protected Thread serverThread
the main server thread

Constructors

 o HDFServer
 public HDFServer()
Creates a new HDFServer without a ServerSocket

 o HDFServer
 public HDFServer(int serverPort,
                  String docRoot)
Creates a new HDFServer with specified document root directory and local port number which the ServerSocket is bonded on

Parameters:
serverPort - the server port number
docRoot - the server document root directory

Methods

 o init
 public void init(ServletConfig conf) throws ServletException
overwrite HttpServlet. sets up the ServletConfig and HDFServer document root directory

Overrides:
init in class GenericServlet
 o service
 public void service(HttpServletRequest req,
                     HttpServletResponse res) throws ServletException, IOException
overwrites FileServlet.

Overrides:
service in class FileServlet
 o doGet
 public void doGet(HttpServletRequest req,
                   HttpServletResponse res) throws ServletException, IOException
sends back an error message because HDF files can not be viewed from a regular browser for the current version of HDFServer.

Parameters:
req - encapsulates the request to the servlet
resp - encapsulates the response from the servlet
Overrides:
doGet in class HttpServlet
 o doPost
 public void doPost(HttpServletRequest req,
                    HttpServletResponse res) throws ServletException, IOException
takes an HDF request from the received HDFMessage and sends back an HDF response by an HDFMessage through ObjectOutputStream

Parameters:
req - encapsulates the request to the servlet
resp - encapsulates the response from the servlet
Overrides:
doPost in class HttpServlet
 o run
 public void run()
overwirte Thread. Sets up a ServerSocket and listen to incoming request. spawns an HDFServerConnection to deal with the request.

 o getDocRoot
 public String getDocRoot()
return the document root of the server

Returns:
the server document root
 o main
 public static void main(String args[])
The main() function sets up and runs the HDFServer.

Parameters:
args[] - the argument list (HDFServer options).
       -h               print out the help information.
       -debug           set the debug on.
       -p  port_number  binds the server to port_number.
       -d  doc_root     sets the document root directory to doc_root.
  

All Packages  Class Hierarchy  This Package  Previous  Next  Index