Quadcap Embeddable Server

com.quadcap.http.servlets.file.FileServlet Class Reference

Inheritance diagram for com.quadcap.http.servlets.file.FileServlet:

HttpServlet List of all members.

Detailed Description

This class implements a generic file-serving servlet.

XXX This implementation is not done; it's been checked in as a work in progress.

Author:
Stan Bailes

Definition at line 74 of file FileServlet.java.

Public Member Functions

void init (ServletConfig config) throws ServletException
 Initialize this servlet.

HttpFile getFileForRequest (HttpServletRequest req) throws Exception
 Return a file object which is suitable for processing the specified request.


Protected Member Functions

void service (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
 Handle an incoming request.


Package Functions

final URL getURL (String path) throws MalformedURLException
final String getContentType (String path)

Package Attributes

Hashtable mimeTypes = new Hashtable()
 A table of mime types, indexed by file extension.

ServletContext context
FileCache files


Member Function Documentation

final String com.quadcap.http.servlets.file.FileServlet.getContentType String  path  )  [package]
 

Definition at line 164 of file FileServlet.java.

References com.quadcap.http.servlets.file.FileServlet.context, and com.quadcap.http.servlets.file.FileServlet.getContentType().

Referenced by com.quadcap.http.servlets.file.FileServlet.getContentType().

HttpFile com.quadcap.http.servlets.file.FileServlet.getFileForRequest HttpServletRequest  req  )  throws Exception
 

Return a file object which is suitable for processing the specified request.

Parameters:
req the http request to service.
Returns:
the file, or null if the file doesn't exist.
Exceptions:
Exception may be thrown.

Definition at line 143 of file FileServlet.java.

References com.quadcap.http.servlets.file.HttpFile.checkModified(), com.quadcap.http.servlets.file.FileServlet.context, com.quadcap.http.servlets.file.FileServlet.files, and com.quadcap.http.servlets.file.FileServlet.getFileForRequest().

Referenced by com.quadcap.http.servlets.file.FileServlet.getFileForRequest(), and com.quadcap.http.servlets.file.FileServlet.service().

final URL com.quadcap.http.servlets.file.FileServlet.getURL String  path  )  throws MalformedURLException [package]
 

Definition at line 160 of file FileServlet.java.

References com.quadcap.http.servlets.file.FileServlet.context, and com.quadcap.http.servlets.file.FileServlet.getURL().

Referenced by com.quadcap.http.servlets.file.FileServlet.getURL(), and com.quadcap.http.servlets.file.HttpFile.init().

void com.quadcap.http.servlets.file.FileServlet.init ServletConfig  config  )  throws ServletException
 

Initialize this servlet.

Parameters:
config the servlet configuration object, containing my initialization parameters
Exceptions:
ServletException if I can't initialize for some reason.

Definition at line 88 of file FileServlet.java.

References com.quadcap.http.servlets.file.FileServlet.context, com.quadcap.http.servlets.file.FileServlet.files, and com.quadcap.http.servlets.file.FileServlet.init().

Referenced by com.quadcap.http.servlets.file.FileServlet.init().

void com.quadcap.http.servlets.file.FileServlet.service HttpServletRequest  req,
HttpServletResponse  res
throws ServletException, IOException [protected]
 

Handle an incoming request.

Parameters:
req HttpServletRequest that encapsulates the request to the servlet
res HttpServletResponse that encapsulates the response from the servlet
Exceptions:
IOException if detected when handling the request
ServletException if the request could not be handled

Definition at line 107 of file FileServlet.java.

References com.quadcap.http.servlets.file.FileServlet.getFileForRequest(), com.quadcap.http.servlets.file.HttpFile.service(), and com.quadcap.http.servlets.file.FileServlet.service().

Referenced by com.quadcap.http.servlets.file.FileServlet.service().


Member Data Documentation

ServletContext com.quadcap.http.servlets.file.FileServlet.context [package]
 

Definition at line 77 of file FileServlet.java.

Referenced by com.quadcap.http.servlets.file.FileServlet.getContentType(), com.quadcap.http.servlets.file.FileServlet.getFileForRequest(), com.quadcap.http.servlets.file.FileServlet.getURL(), and com.quadcap.http.servlets.file.FileServlet.init().

FileCache com.quadcap.http.servlets.file.FileServlet.files [package]
 

Definition at line 79 of file FileServlet.java.

Referenced by com.quadcap.http.servlets.file.FileServlet.getFileForRequest(), and com.quadcap.http.servlets.file.FileServlet.init().

Hashtable com.quadcap.http.servlets.file.FileServlet.mimeTypes = new Hashtable() [package]
 

A table of mime types, indexed by file extension.

Definition at line 76 of file FileServlet.java.