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
-
DISPLAY_LENGTH
- the maximum string length of the displayed file names
-
FileServlet()
- Creates a new FileServlet with default parameters.
-
copyStream(InputStream, OutputStream)
- copy byte streams from an InputStream to an OutputStream.
-
dispatchPathname(HttpServletRequest, HttpServletResponse, boolean, String, String)
- dispatch the path name for service
-
formatFileLength(long)
- format the file size in bytes, megabytes, gigabytes or tarabytes
-
getServletInfo()
- Returns a string containing information about the author,
version, and copyright of the servlet.
-
redirectDirectory(HttpServletRequest, HttpServletResponse, String, File)
- redirectory
-
serveDirectory(HttpServletRequest, HttpServletResponse, boolean, String, String, File)
- serve a direcotry request (GET or HEAD)
-
serveFile(HttpServletRequest, HttpServletResponse, boolean, String, String, File)
- serve a file request (GET or HEAD)
-
service(HttpServletRequest, HttpServletResponse)
- Services a single request from the client.
DISPLAY_LENGTH
public static final int DISPLAY_LENGTH
- the maximum string length of the displayed file names
FileServlet
public FileServlet()
- Creates a new FileServlet with default parameters.
getServletInfo
public String getServletInfo()
- Returns a string containing information about the author,
version, and copyright of the servlet.
- Overrides:
- getServletInfo in class GenericServlet
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
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.
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.
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.
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
copyStream
protected void copyStream(InputStream in,
OutputStream out) throws IOException
- copy byte streams from an InputStream to an OutputStream.
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