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
-
debug
- debug flag
-
documentDir
- The document root directory for serving files.
-
mainSocket
- the HDFServer main ServerSocket
-
port
- the HDFServer port number
-
serverThread
- the main server thread
-
HDFServer()
- Creates a new HDFServer without a ServerSocket
-
HDFServer(int, String)
- Creates a new HDFServer with specified document root directory and
local port number which the ServerSocket is bonded on
-
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.
-
doPost(HttpServletRequest, HttpServletResponse)
- takes an HDF request from the received HDFMessage and sends back an HDF
response by an HDFMessage through ObjectOutputStream
-
getDocRoot()
- return the document root of the server
-
init(ServletConfig)
- overwrite HttpServlet.
-
main(String[])
- The main() function sets up and runs the HDFServer.
-
run()
- overwirte Thread.
-
service(HttpServletRequest, HttpServletResponse)
- overwrites FileServlet.
debug
public static boolean debug
- debug flag
documentDir
protected String documentDir
- The document root directory for serving files.
port
protected int port
- the HDFServer port number
mainSocket
protected ServerSocket mainSocket
- the HDFServer main ServerSocket
serverThread
protected Thread serverThread
- the main server thread
HDFServer
public HDFServer()
- Creates a new HDFServer without a ServerSocket
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
init
public void init(ServletConfig conf) throws ServletException
- overwrite HttpServlet.
sets up the ServletConfig and HDFServer document root directory
- Overrides:
- init in class GenericServlet
service
public void service(HttpServletRequest req,
HttpServletResponse res) throws ServletException, IOException
- overwrites FileServlet.
- Overrides:
- service in class FileServlet
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
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
run
public void run()
- overwirte Thread.
Sets up a ServerSocket and listen to incoming request.
spawns an HDFServerConnection to deal with the request.
getDocRoot
public String getDocRoot()
- return the document root of the server
- Returns:
- the server document root
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