|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.figure8.join.control.DownloadServlet
public class DownloadServlet
Servlet that allows to download a file which full UNC path is put into to the query parameters ("path" denotes the directory and "file" short name of file itself).
Field Summary | |
---|---|
protected java.lang.String |
notExistsURL
URL to redirect to in case the specified file does not exists. |
protected java.lang.String |
notReadableURL
URL to redirect to in case the specified file is not readable. |
Constructor Summary | |
---|---|
DownloadServlet()
|
Method Summary | |
---|---|
void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Override of default doGet() method: just call the protected
downloadFile() method, passing around request and response. |
protected void |
downloadFile(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Retrieve the file to download path from query string. |
protected void |
dumpFile(java.io.File file,
java.io.OutputStream os)
Dump a file content into the given ouput stream. |
void |
init()
Override of default init() method. |
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 |
---|
protected java.lang.String notExistsURL
protected java.lang.String notReadableURL
Constructor Detail |
---|
public DownloadServlet()
Method Detail |
---|
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- if one init parameter is missingpublic void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
doGet()
method: just call the protected
downloadFile()
method, passing around request and response.
doGet
in class javax.servlet.http.HttpServlet
request
- The http request (containing query string specifying file)response
- Thee http response (for writing ouput)
java.io.IOException
- if requested file cannot be opened or written to response
javax.servlet.ServletException
- in any other exception caseprotected void downloadFile(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
request
- The http request (containing parameters specifying file)response
- Thee http response (for writing ouput)
java.io.IOException
- if outputstream cannot be opened or writtenprotected void dumpFile(java.io.File file, java.io.OutputStream os)
file
- The file to dumpos
- The ouput stream to dump in
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |