Package com.logicaldoc.web
Class UploadServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- gwtupload.server.UploadServlet
-
- gwtupload.server.UploadAction
-
- com.logicaldoc.web.UploadServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public class UploadServlet extends gwtupload.server.UploadActionThis servlet is responsible for document uploads operations.- Since:
- 6.0
- Author:
- Marco Meschieri - LogicalDOC
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringRECEIVEDCONTENTTYPESstatic StringRECEIVEDFILENAMESstatic StringRECEIVEDFILES
-
Constructor Summary
Constructors Constructor Description UploadServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckRequest(javax.servlet.http.HttpServletRequest request)static voidcleanReceivedFiles(String sid)static voidcleanReceivedFiles(javax.servlet.http.HttpSession session)StringexecuteAction(javax.servlet.http.HttpServletRequest request, List<org.apache.commons.fileupload.FileItem> sessionFiles)Override executeAction to save the received files in a custom place and delete this items from sessionstatic Map<String,String>getReceivedFileNames(javax.servlet.http.HttpServletRequest request, String sid)static Map<String,File>getReceivedFiles(javax.servlet.http.HttpServletRequest request, String sid)voidgetUploadedFile(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Get the content of an uploaded filestatic booleanisAllowedForUpload(String filename, String tenant)Checks if the passed filename can be uploaded or not on the basis of what configured in 'upload.disallow'voidremoveItem(javax.servlet.http.HttpServletRequest request, String fieldName)Remove a file when the user sends a delete request-
Methods inherited from class gwtupload.server.UploadAction
getFileStream, getFormField, init, removeItem
-
Methods inherited from class gwtupload.server.UploadServlet
cancelUpload, copyFromInputStreamToOutputStream, findFileItem, findItemByFieldName, findItemByFileName, getInitParameter, getLastReceivedFileItems, getLastReceivedFileItems, getMessage, getMyLastReceivedFileItems, getMySessionFileItems, getSessionFileItems, getSessionFileItems, getSessionItems, getThreadLocalRequest, isAppEngine, removeSessionFileItems, removeSessionFileItems, removeSessionFileItems, removeSessionFileItems
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
-
-
-
Method Detail
-
executeAction
public String executeAction(javax.servlet.http.HttpServletRequest request, List<org.apache.commons.fileupload.FileItem> sessionFiles) throws gwtupload.server.exceptions.UploadActionException
Override executeAction to save the received files in a custom place and delete this items from session- Overrides:
executeActionin classgwtupload.server.UploadAction- Parameters:
request- the HTTP requestsessionFiles- list of file items- Returns:
- always null
- Throws:
gwtupload.server.exceptions.UploadActionException- error on the server handling the upload
-
checkRequest
public void checkRequest(javax.servlet.http.HttpServletRequest request)
- Overrides:
checkRequestin classgwtupload.server.UploadServlet
-
removeItem
public void removeItem(javax.servlet.http.HttpServletRequest request, String fieldName) throws gwtupload.server.exceptions.UploadActionExceptionRemove a file when the user sends a delete request- Overrides:
removeItemin classgwtupload.server.UploadAction- Parameters:
request- the HTTP requestfieldName- name of the field- Throws:
gwtupload.server.exceptions.UploadActionException- error on the server handling the upload
-
getUploadedFile
public void getUploadedFile(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOExceptionGet the content of an uploaded file- Overrides:
getUploadedFilein classgwtupload.server.UploadServlet- Parameters:
request- the HTTP requestresponse- the server's response- Throws:
IOException- generic I/O error
-
getReceivedFiles
public static Map<String,File> getReceivedFiles(javax.servlet.http.HttpServletRequest request, String sid)
-
getReceivedFileNames
public static Map<String,String> getReceivedFileNames(javax.servlet.http.HttpServletRequest request, String sid)
-
isAllowedForUpload
public static boolean isAllowedForUpload(String filename, String tenant)
Checks if the passed filename can be uploaded or not on the basis of what configured in 'upload.disallow'- Parameters:
filename- name of the filetenant- name of the tenant- Returns:
- true id the filename is allowed
-
cleanReceivedFiles
public static void cleanReceivedFiles(String sid)
-
cleanReceivedFiles
public static void cleanReceivedFiles(javax.servlet.http.HttpSession session)
-
-