All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.hdf.server.FileServlet

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

public class FileServlet
extends HttpServlet
FileServlet implements the "GET" and "HEAD" methods for files and directories. It also handles index.html.

See Also:
HttpServlet

Variable Index

 o DISPLAY_LENGTH
the maximum string length of the displayed file names

Constructor Index

 o FileServlet()
Creates a new FileServlet with default parameters.

Method Index

 o copyStream(InputStream, OutputStream)
copy byte streams from an InputStream to an OutputStream.
 o dispatchPathname(HttpServletRequest, HttpServletResponse, boolean, String, String)
dispatch the path name for service
 o formatFileLength(long)
format the file size in bytes, megabytes, gigabytes or tarabytes
 o getServletInfo()
Returns a string containing information about the author, version, and copyright of the servlet.
 o redirectDirectory(HttpServletRequest, HttpServletResponse, String, File)
redirectory
 o serveDirectory(HttpServletRequest, HttpServletResponse, boolean, String, String, File)
serve a direcotry request (GET or HEAD)
 o serveFile(HttpServletRequest, HttpServletResponse, boolean, String, String, File)
serve a file request (GET or HEAD)
 o service(HttpServletRequest, HttpServletResponse)
Services a single request from the client.

Variables

 o DISPLAY_LENGTH
 public static final int DISPLAY_LENGTH
the maximum string length of the displayed file names

Constructors

 o FileServlet
 public FileServlet()
Creates a new FileServlet with default parameters.

Methods

 o getServletInfo
 public String getServletInfo()
Returns a string containing information about the author, version, and copyright of the servlet.

Overrides:
getServletInfo in class GenericServlet
 o service
 public void service(HttpServletRequest req,
                     HttpServletResponse res) throws ServletException, IOException
Services a single request from the client.

Parameters:
req - the servlet request
res - the servlet response
Throws: ServletException
when an exception has occurred
Overrides:
service in class HttpServlet
 o dispatchPathname
 protected void dispatchPathname(HttpServletRequest req,
                                 HttpServletResponse res,
                                 boolean headOnly,
                                 String path,
                                 String pathname) throws IOException
dispatch the path name for service

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
headOnly - ask only the HEAD
path - the string of the file path
pathname - the string of the path name
Throws: an
IOException.
 o serveFile
 protected void serveFile(HttpServletRequest req,
                          HttpServletResponse res,
                          boolean headOnly,
                          String path,
                          String filename,
                          File file) throws IOException
serve a file request (GET or HEAD)

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
headOnly - ask only the HEAD
path - the string of the file path
filename - the string of the file name
file - the file requested
Throws: an
IOException.
 o serveDirectory
 protected void serveDirectory(HttpServletRequest req,
                               HttpServletResponse res,
                               boolean headOnly,
                               String path,
                               String filename,
                               File file) throws IOException
serve a direcotry request (GET or HEAD)

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
headOnly - ask only the HEAD
path - the string of the file path
filename - the string of the file name
file - the file requested
Throws: an
IOException.
 o redirectDirectory
 protected void redirectDirectory(HttpServletRequest req,
                                  HttpServletResponse res,
                                  String path,
                                  File file) throws IOException
redirectory

Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
path - the string of the file path
file - the file requested
 o copyStream
 protected void copyStream(InputStream in,
                           OutputStream out) throws IOException
copy byte streams from an InputStream to an OutputStream.

 o formatFileLength
 public String formatFileLength(long fileLength)
format the file size in bytes, megabytes, gigabytes or tarabytes

Parameters:
fileLength - the orriginal file size in bytes
Returns:
the formated file size in bytes, megabytes, gigabytes or tarabytes

All Packages  Class Hierarchy  This Package  Previous  Next  Index