za.org.coefficient.servlet
Class GenericDownloadServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
za.org.coefficient.servlet.GenericDownloadServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class GenericDownloadServlet
- extends javax.servlet.http.HttpServlet
This is the generic download servlet. It allows any module to register
a listener method for downloading files. Once the downloader servlet is
called it calls the registered method from a module.
- Author:
- Leon Messerschmidt
- See Also:
- Serialized Form
Method Summary |
static void |
addProvider(java.lang.String provider,
java.lang.String module,
java.lang.String method)
Add a new downloader provider to the system. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Call the download provider |
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Redirects to doGet |
private void |
sendError(javax.servlet.http.HttpServletResponse response,
java.lang.String error)
Formats an error that is sent to the user in a human readible string |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fileProviders
private static java.util.Map fileProviders
GenericDownloadServlet
public GenericDownloadServlet()
addProvider
public static void addProvider(java.lang.String provider,
java.lang.String module,
java.lang.String method)
- Add a new downloader provider to the system.
- Parameters:
provider
- module
- method
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Call the download provider
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
doPost
protected void doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
java.io.IOException
- Redirects to doGet
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
- See Also:
doGet
,
HttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
sendError
private void sendError(javax.servlet.http.HttpServletResponse response,
java.lang.String error)
- Formats an error that is sent to the user in a human readible string
- Parameters:
response
- error
-
Copyright CSIR. All Rights Reserved.