Class FileUploadDownloadServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.apgar.common.lib.ui.widget.fileattachmentwidget.FileUploadDownloadServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public class FileUploadDownloadServlet
extends javax.servlet.http.HttpServlet
Servlet class responsible for handling the file storage as a hash and retrieving.
This class extends HttpServlet and performs GET and POST calls concerning the file
to save it or read it from the upload directory which needs to be specified in the web.xml of your project.
Here is an example of how to define this servlet in your project's web.xml along with the fielUploadDirectory where your files will be stored.
<servlet>
<servlet-name>FileUploadDownloadServlet</servlet-name>
<servlet-class>com.apgar.common.lib.ui.widget.fileattachmentwidget.FileUploadDownloadServlet</servlet-class>
<init-param>
<param-name>fileUploadDirectory</param-name>
<param-value>C:/apps/workspaces/YourProject/ebxHome/uploadDir</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FileUploadDownloadServlet</servlet-name>
<url-pattern>/FileUploadDownloadServlet</url-pattern>
</servlet-mapping>
- Author:
- APGAR Consulting
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse) protected voiddoPost(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse) voidinit(javax.servlet.ServletConfig config) voidsetFileUploadDirectory(String fileUploadDirectory) Sets the fileUploadDirectory variable which corresponds to the String path of the file directory in your project.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
FileUploadDownloadServlet
public FileUploadDownloadServlet()
-
-
Method Details
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
doPost
protected void doPost(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse) throws javax.servlet.ServletException, IOException - Overrides:
doPostin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse) throws javax.servlet.ServletException, IOException - Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
-
setFileUploadDirectory
Sets the fileUploadDirectory variable which corresponds to the String path of the file directory in your project.- Parameters:
fileUploadDirectory- String
-