Interface IAsyncUploadHandler

  • All Superinterfaces:
    fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
    All Known Implementing Classes:
    AbstractAsynchronousUploadHandler, AsynchronousUploadHandler

    public interface IAsyncUploadHandler
    extends fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
    Interface for asynchronous upload handlers used by entries of type upload. Handler must be declared as Spring beans.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void addFileItemToPartialUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem, String strFieldName, javax.servlet.http.HttpServletRequest request)
      Add file item to the list of partial uploaded files
      void addFileItemToUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem, String strFieldName, javax.servlet.http.HttpServletRequest request)
      Add a file item to the list of uploaded files
      void addFilesUploadedSynchronously​(javax.servlet.http.HttpServletRequest request, String strFieldName)
      Add files uploaded synchronously for a given field
      String canUploadFiles​(javax.servlet.http.HttpServletRequest request, String strFieldName, List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload, Locale locale)
      Check if the file can be uploaded or not.
      void doRemoveFile​(javax.servlet.http.HttpServletRequest request, String strFieldName)
      Do remove a file of a given entry if a flag is present in the request.
      String doRemoveUploadedFile​(javax.servlet.http.HttpServletRequest request, String strFieldName, List<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.
      String getHandlerName()
      Get the name of the handler.
      List<org.apache.commons.fileupload.FileItem> getListPartialUploadedFiles​(String strFieldName, javax.servlet.http.HttpSession session)
      Gets the list of partial upload files for a given field and a given session.
      List<org.apache.commons.fileupload.FileItem> getListUploadedFiles​(String strFieldName, javax.servlet.http.HttpSession session)
      Gets the list of upload files for a given field and a given session.
      String getUploadCheckboxPrefix()
      Get the upload checkbox prefix
      String getUploadDeletePrefix()
      Get the upload delete prefix
      String getUploadSubmitPrefix()
      Get the upload submit prefix
      boolean hasAddFileFlag​(javax.servlet.http.HttpServletRequest request, String strFieldName)
      Check if the request has the flag to submit a file without submitting the form.
      boolean hasRemoveFlag​(javax.servlet.http.HttpServletRequest request, String strFieldName)
      Check if the request has a remove flag for a given entry.
      boolean isManagePartialContent()  
      void removeAllFileItem​(javax.servlet.http.HttpSession session)
      Remove all file Item for a given session
      void removeFileItem​(String strFieldName, javax.servlet.http.HttpSession session, int nIndex)
      Remove file Item
      default void removeSessionFiles​(javax.servlet.http.HttpSession session)
      Removes all files associated to the session
      • Methods inherited from interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2

        isInvoked, process
    • Method Detail

      • getUploadSubmitPrefix

        String getUploadSubmitPrefix()
        Get the upload submit prefix
        Returns:
        The upload submit prefix
      • getUploadDeletePrefix

        String getUploadDeletePrefix()
        Get the upload delete prefix
        Returns:
        The upload delete prefix
      • getUploadCheckboxPrefix

        String getUploadCheckboxPrefix()
        Get the upload checkbox prefix
        Returns:
        The upload checkbox prefix
      • canUploadFiles

        String canUploadFiles​(javax.servlet.http.HttpServletRequest request,
                              String strFieldName,
                              List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload,
                              Locale locale)
        Check if the file can be uploaded or not.
        Parameters:
        request - The request
        strFieldName - the field name
        listFileItemsToUpload - the list of files to upload
        locale - the locale
        Returns:
        The error message if any, or null if the files can be uploaded.
      • getListUploadedFiles

        List<org.apache.commons.fileupload.FileItem> getListUploadedFiles​(String strFieldName,
                                                                          javax.servlet.http.HttpSession session)
        Gets the list of 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.
        Parameters:
        strFieldName - the field name
        session - The session of the current user
        Returns:
        the fileItem found, null otherwise.
      • getListPartialUploadedFiles

        List<org.apache.commons.fileupload.FileItem> getListPartialUploadedFiles​(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.
        Parameters:
        strFieldName - the field name
        session - The session of the current user
        Returns:
        the fileItem found, null otherwise.
      • removeFileItem

        void removeFileItem​(String strFieldName,
                            javax.servlet.http.HttpSession session,
                            int nIndex)
        Remove file Item
        Parameters:
        strFieldName - the field name
        session - The session of the current user
        nIndex - the index of the file to remove (from 0 to n). The index is the index of the file in the uploaded file list given by the method getListUploadedFiles(String, HttpSession)
      • removeAllFileItem

        void removeAllFileItem​(javax.servlet.http.HttpSession session)
        Remove all file Item for a given session
        Parameters:
        session - The session of the current user
      • addFileItemToUploadedFilesList

        void addFileItemToUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem,
                                            String strFieldName,
                                            javax.servlet.http.HttpServletRequest request)
        Add a file item to the list of uploaded files
        Parameters:
        fileItem - the file item
        strFieldName - the field name
        request - the request
      • addFileItemToPartialUploadedFilesList

        void addFileItemToPartialUploadedFilesList​(org.apache.commons.fileupload.FileItem fileItem,
                                                   String strFieldName,
                                                   javax.servlet.http.HttpServletRequest request)
        Add file item to the list of partial uploaded files
        Parameters:
        fileItem - the file item
        strFieldName - the field name
        request - the request
      • hasRemoveFlag

        boolean hasRemoveFlag​(javax.servlet.http.HttpServletRequest request,
                              String strFieldName)
        Check if the request has a remove flag for a given entry.
        Parameters:
        request - The request
        strFieldName - The field name
        Returns:
        True if the request has a remove flag for the given entry, false otherwise
      • doRemoveFile

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

        String doRemoveUploadedFile​(javax.servlet.http.HttpServletRequest request,
                                    String strFieldName,
                                    List<Integer> listIndexesFilesToRemove)
        Do remove a list of files from uploaded files.
        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
      • hasAddFileFlag

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

        void addFilesUploadedSynchronously​(javax.servlet.http.HttpServletRequest request,
                                           String strFieldName)
        Add files uploaded synchronously for a given field
        Parameters:
        request - The request
        strFieldName - The name of the field to add files of
      • getHandlerName

        String getHandlerName()
        Get the name of the handler. The name of the handler must be unique. The handler name must only contain alphabetic characters (no point, no space, no coma, no #, ...).
        Returns:
        The name of the handler
      • doRetrieveUploadedFile

        byte[] doRetrieveUploadedFile​(javax.servlet.http.HttpServletRequest request)
        Do retrieve a file from uploaded files.
        Parameters:
        request - The request
        Returns:
        The file
      • isManagePartialContent

        boolean isManagePartialContent()
        Returns:
        true if the handler manage partial content
      • removeSessionFiles

        default void removeSessionFiles​(javax.servlet.http.HttpSession session)
        Removes all files associated to the session
        Parameters:
        strSessionId - the session id