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.UploadAction
This 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 String
RECEIVEDCONTENTTYPES
static String
RECEIVEDFILENAMES
static String
RECEIVEDFILES
-
Constructor Summary
Constructors Constructor Description UploadServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkRequest(javax.servlet.http.HttpServletRequest request)
static void
cleanReceivedFiles(String sid)
static void
cleanReceivedFiles(javax.servlet.http.HttpSession session)
String
executeAction(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)
void
getUploadedFile(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Get the content of an uploaded filestatic 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'void
removeItem(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:
executeAction
in 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:
checkRequest
in classgwtupload.server.UploadServlet
-
removeItem
public void removeItem(javax.servlet.http.HttpServletRequest request, String fieldName) throws gwtupload.server.exceptions.UploadActionException
Remove a file when the user sends a delete request- Overrides:
removeItem
in 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 IOException
Get the content of an uploaded file- Overrides:
getUploadedFile
in 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)
-
-