|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.sun.slamd.misc.GetFile
This class defines a servlet that makes it possible for a client to request a file from the Web server, and have the Web server distribute a different file for each request. The individual files to distribute should exist in a specified location on the filesystem and should be named with the same base name followed by a period and a sequentially-incrmenting number starting at 1. For example, if a request for the file "myfile" should return one of five files, then the files to be retrieved should be named "myfile.1", "myfile.2", "myfile.3", "myfile.4", and "myfile.5".
| Field Summary | |
static java.lang.String |
ACCESS_MODE_RANDOM
The access mode that indicates that the files should be retrieved in random order. |
static java.lang.String |
ACCESS_MODE_REMOVE
The access mode that indicates that information about the specified file should be removed from the file data cache. |
static java.lang.String |
ACCESS_MODE_SEQUENTIAL
The access mode that indicates that the files should be retrieved in sequential order. |
static java.lang.String |
SERVLET_INIT_PARAM_FILE_DIRECTORY
The name of the servlet initialization parameter that specifies the directory in which to look for the requested files. |
static java.lang.String |
SERVLET_PARAM_ACCESS_MODE
The name of the servlet parameter that specifies the access mode that should be used when retrieving the files. |
static java.lang.String |
SERVLET_PARAM_FILENAME
The name of the servlet parameter that specifies the file to retrieve. |
| Constructor Summary | |
GetFile()
|
|
| Method Summary | |
GetFileCacheItem |
createCacheItem(java.lang.String filename)
Creates a cache item with information about the specified file. |
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Processes the servlet request and returns the appropriate file. |
void |
init()
Performs the necessary initialization for this servlet. |
void |
sendFile(javax.servlet.http.HttpServletResponse response,
java.lang.String fileToRetrieve)
Sends the contents of the specified file back to the client. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String SERVLET_INIT_PARAM_FILE_DIRECTORY
public static final java.lang.String SERVLET_PARAM_FILENAME
public static final java.lang.String SERVLET_PARAM_ACCESS_MODE
public static final java.lang.String ACCESS_MODE_SEQUENTIAL
public static final java.lang.String ACCESS_MODE_RANDOM
public static final java.lang.String ACCESS_MODE_REMOVE
| Constructor Detail |
public GetFile()
| Method Detail |
public void init()
public void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException
request - Information about the request received from the client.response - Information about the response to send back to the
client.
java.io.IOException - If a problem occurs while sending the response back
to the client.public GetFileCacheItem createCacheItem(java.lang.String filename)
filename - The name of the file to be cached.
null if the file does not exist.
public void sendFile(javax.servlet.http.HttpServletResponse response,
java.lang.String fileToRetrieve)
throws java.io.IOException
response - The response object to use to send the data back
to the client.fileToRetrieve - The name of the actual file to retrieve.
java.io.IOException - If a problem occurs while trying to send the file
data to the client.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||