Class 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
    • Nested Class Summary

      • Nested classes/interfaces inherited from class gwtupload.server.UploadServlet

        gwtupload.server.UploadServlet.DefaultFileItemFactory
    • 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 session
      static 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 file
      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'
      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.http.HttpServlet

        service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
      • Methods inherited from interface javax.servlet.Servlet

        destroy, getServletConfig, getServletInfo, service
    • Field Detail

      • RECEIVEDFILES

        public static String RECEIVEDFILES
      • RECEIVEDCONTENTTYPES

        public static String RECEIVEDCONTENTTYPES
      • RECEIVEDFILENAMES

        public static String RECEIVEDFILENAMES
    • Constructor Detail

      • UploadServlet

        public UploadServlet()
    • 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 class gwtupload.server.UploadAction
        Parameters:
        request - the HTTP request
        sessionFiles - 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 class gwtupload.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 class gwtupload.server.UploadAction
        Parameters:
        request - the HTTP request
        fieldName - 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 class gwtupload.server.UploadServlet
        Parameters:
        request - the HTTP request
        response - 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 file
        tenant - 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)