Class AbstractAsynchronousUploadHandler

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFileItemToPartialUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem, java.lang.String strFieldName, javax.servlet.http.HttpServletRequest request)
      Add file item to the list of partial uploaded files
      void addFilesUploadedSynchronously​(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)
      Add files uploaded synchronously for a given field
      void doRemoveFile​(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)
      Do remove a file of a given entry if a flag is present in the request.
      java.lang.String doRemoveUploadedFile​(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName, java.util.List<java.lang.Integer> listIndexesFilesToRemove)
      Do remove a list of files from uploaded files.
      byte[] doRetrieveUploadedFile​(javax.servlet.http.HttpServletRequest request)
      Do retrieve a file from uploaded files.
      java.util.List<org.apache.commons.fileupload.FileItem> getListPartialUploadedFiles​(java.lang.String strFieldName, javax.servlet.http.HttpSession session)
      Gets the list of partial upload files for a given field and a given session.
      java.lang.String getUploadAction​(javax.servlet.http.HttpServletRequest request)
      Checks the request parameters to see if an upload submit has been called.
      java.lang.String getUploadCheckboxPrefix()
      Get the upload checkbox prefix
      java.lang.String getUploadDeletePrefix()
      Get the upload delete prefix
      java.lang.String getUploadSubmitPrefix()
      Get the upload submit prefix
      boolean hasAddFileFlag​(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)
      Check if the request has the flag to submit a file without submitting the form.
      boolean hasRemoveFlag​(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)
      Check if the request has a remove flag for a given entry.
      boolean isInvoked​(javax.servlet.http.HttpServletRequest request)
      boolean isManagePartialContent()
      void process​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.util.Map<java.lang.String,​java.lang.Object> map, java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)  
      void removeAllFileItem​(javax.servlet.http.HttpSession session)
      Remove all file Item for a given session
      void removeFileItem​(java.lang.String strFieldName, javax.servlet.http.HttpSession session, int nIndex)
      Remove file Item
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractAsynchronousUploadHandler

        public AbstractAsynchronousUploadHandler()
    • Method Detail

      • process

        public void process​(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response,
                            java.util.Map<java.lang.String,​java.lang.Object> map,
                            java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload)
        Specified by:
        process in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
      • getUploadAction

        public java.lang.String getUploadAction​(javax.servlet.http.HttpServletRequest request)
        Checks the request parameters to see if an upload submit has been called.
        Parameters:
        request - the HTTP request
        Returns:
        the name of the upload action, if any. Null otherwise.
      • doRemoveFile

        public void doRemoveFile​(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String strFieldName)
        Do remove a file of a given entry if a flag is present in the request. Files are selected from the request.
        Specified by:
        doRemoveFile in interface IAsyncUploadHandler
        Parameters:
        request - The request
        strFieldName - The field name
      • doRemoveUploadedFile

        public java.lang.String doRemoveUploadedFile​(javax.servlet.http.HttpServletRequest request,
                                                     java.lang.String strFieldName,
                                                     java.util.List<java.lang.Integer> listIndexesFilesToRemove)
        Do remove a list of files from uploaded files.
        Specified by:
        doRemoveUploadedFile in interface IAsyncUploadHandler
        Parameters:
        request - The request
        strFieldName - The field name of the files to remove
        listIndexesFilesToRemove - The list of indexes of files to remove
        Returns:
        The result JSON
      • hasRemoveFlag

        public boolean hasRemoveFlag​(javax.servlet.http.HttpServletRequest request,
                                     java.lang.String strFieldName)
        Check if the request has a remove flag for a given entry.
        Specified by:
        hasRemoveFlag in interface IAsyncUploadHandler
        Parameters:
        request - The request
        strFieldName - The field name
        Returns:
        True if the request has a remove flag for the given entry, false otherwise
      • isInvoked

        public boolean isInvoked​(javax.servlet.http.HttpServletRequest request)
        Specified by:
        isInvoked in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
      • hasAddFileFlag

        public boolean hasAddFileFlag​(javax.servlet.http.HttpServletRequest request,
                                      java.lang.String strFieldName)
        Check if the request has the flag to submit a file without submitting the form.
        Specified by:
        hasAddFileFlag in interface IAsyncUploadHandler
        Parameters:
        request - The request
        strFieldName - The id of the entry
        Returns:
        True if the flag is present in the request, false otherwise
      • addFilesUploadedSynchronously

        public void addFilesUploadedSynchronously​(javax.servlet.http.HttpServletRequest request,
                                                  java.lang.String strFieldName)
        Add files uploaded synchronously for a given field
        Specified by:
        addFilesUploadedSynchronously in interface IAsyncUploadHandler
        Parameters:
        request - The request
        strFieldName - The name of the field to add files of
      • getUploadSubmitPrefix

        public java.lang.String getUploadSubmitPrefix()
        Get the upload submit prefix
        Specified by:
        getUploadSubmitPrefix in interface IAsyncUploadHandler
        Returns:
        The upload submit prefix
      • getUploadDeletePrefix

        public java.lang.String getUploadDeletePrefix()
        Get the upload delete prefix
        Specified by:
        getUploadDeletePrefix in interface IAsyncUploadHandler
        Returns:
        The upload delete prefix
      • getUploadCheckboxPrefix

        public java.lang.String getUploadCheckboxPrefix()
        Get the upload checkbox prefix
        Specified by:
        getUploadCheckboxPrefix in interface IAsyncUploadHandler
        Returns:
        The upload checkbox prefix
      • doRetrieveUploadedFile

        public byte[] doRetrieveUploadedFile​(javax.servlet.http.HttpServletRequest request)
        Do retrieve a file from uploaded files.
        Specified by:
        doRetrieveUploadedFile in interface IAsyncUploadHandler
        Parameters:
        request - The request
        Returns:
        The file
      • getListPartialUploadedFiles

        public java.util.List<org.apache.commons.fileupload.FileItem> getListPartialUploadedFiles​(java.lang.String strFieldName,
                                                                                                  javax.servlet.http.HttpSession session)
        Gets the list of partial upload files for a given field and a given session. The order of files in the list must be the upload order. Their index in this list (from 0 to the list size) will be used to identify them.
        Specified by:
        getListPartialUploadedFiles in interface IAsyncUploadHandler
        Parameters:
        strFieldName - the field name
        session - The session of the current user
        Returns:
        the fileItem found, null otherwise.
      • addFileItemToPartialUploadedFilesList

        public void addFileItemToPartialUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem,
                                                          java.lang.String strFieldName,
                                                          javax.servlet.http.HttpServletRequest request)
        Add file item to the list of partial uploaded files
        Specified by:
        addFileItemToPartialUploadedFilesList in interface IAsyncUploadHandler
        Parameters:
        fileItem - the file item
        strFieldName - the field name
        request - the request
      • removeAllFileItem

        public void removeAllFileItem​(javax.servlet.http.HttpSession session)
        Remove all file Item for a given session
        Specified by:
        removeAllFileItem in interface IAsyncUploadHandler
        Parameters:
        session - The session of the current user