Class AbstractAsynchronousUploadHandler

java.lang.Object
fr.paris.lutece.plugins.asynchronousupload.service.AbstractAsynchronousUploadHandler
All Implemented Interfaces:
IAsyncUploadHandler, fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
Direct Known Subclasses:
AsynchronousUploadHandler

public abstract class AbstractAsynchronousUploadHandler extends Object implements IAsyncUploadHandler
AbstractAsynchronousUploadHandler.
  • Constructor Details

    • AbstractAsynchronousUploadHandler

      public AbstractAsynchronousUploadHandler()
  • Method Details

    • process

      public void process(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Map<String,Object> map, List<fr.paris.lutece.portal.service.upload.MultipartItem> listFileItemsToUpload)
      Specified by:
      process in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
    • getUploadAction

      public String getUploadAction(jakarta.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(jakarta.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.
      Specified by:
      doRemoveFile in interface IAsyncUploadHandler
      Parameters:
      request - The request
      strFieldName - The field name
    • doRemoveUploadedFile

      public String doRemoveUploadedFile(jakarta.servlet.http.HttpServletRequest request, String strFieldName, List<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(jakarta.servlet.http.HttpServletRequest request, 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(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      isInvoked in interface fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
    • hasAddFileFlag

      public boolean hasAddFileFlag(jakarta.servlet.http.HttpServletRequest request, 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(jakarta.servlet.http.HttpServletRequest request, 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 String getUploadSubmitPrefix()
      Get the upload submit prefix
      Specified by:
      getUploadSubmitPrefix in interface IAsyncUploadHandler
      Returns:
      The upload submit prefix
    • getUploadDeletePrefix

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

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

      public byte[] doRetrieveUploadedFile(jakarta.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 List<fr.paris.lutece.portal.service.upload.MultipartItem> getListPartialUploadedFiles(String strFieldName, jakarta.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(fr.paris.lutece.portal.service.upload.MultipartItem fileItem, String strFieldName, jakarta.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
    • isManagePartialContent

      public boolean isManagePartialContent()
      Specified by:
      isManagePartialContent in interface IAsyncUploadHandler
      Returns:
      true if the handler manage partial content
    • removeAllFileItem

      public void removeAllFileItem(jakarta.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
    • removeFileItem

      public void removeFileItem(String strFieldName, jakarta.servlet.http.HttpSession session, int nIndex)
      Description copied from interface: IAsyncUploadHandler
      Remove file Item
      Specified by:
      removeFileItem in interface IAsyncUploadHandler
      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 IAsyncUploadHandler.getListUploadedFiles(String, HttpSession)