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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileItemToPartialUploadedFilesList(fr.paris.lutece.portal.service.upload.MultipartItem fileItem, String strFieldName, jakarta.servlet.http.HttpServletRequest request) Add file item to the list of partial uploaded filesvoidaddFilesUploadedSynchronously(jakarta.servlet.http.HttpServletRequest request, String strFieldName) Add files uploaded synchronously for a given fieldvoiddoRemoveFile(jakarta.servlet.http.HttpServletRequest request, String strFieldName) Do remove a file of a given entry if a flag is present in the request.doRemoveUploadedFile(jakarta.servlet.http.HttpServletRequest request, String strFieldName, List<Integer> listIndexesFilesToRemove) Do remove a list of files from uploaded files.byte[]doRetrieveUploadedFile(jakarta.servlet.http.HttpServletRequest request) Do retrieve a file from uploaded files.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.getUploadAction(jakarta.servlet.http.HttpServletRequest request) Checks the request parameters to see if an upload submit has been called.Get the upload checkbox prefixGet the upload delete prefixGet the upload submit prefixbooleanhasAddFileFlag(jakarta.servlet.http.HttpServletRequest request, String strFieldName) Check if the request has the flag to submit a file without submitting the form.booleanhasRemoveFlag(jakarta.servlet.http.HttpServletRequest request, String strFieldName) Check if the request has a remove flag for a given entry.booleanisInvoked(jakarta.servlet.http.HttpServletRequest request) booleanvoidprocess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Map<String, Object> map, List<fr.paris.lutece.portal.service.upload.MultipartItem> listFileItemsToUpload) voidremoveAllFileItem(jakarta.servlet.http.HttpSession session) Remove all file Item for a given sessionvoidremoveFileItem(String strFieldName, jakarta.servlet.http.HttpSession session, int nIndex) Remove file ItemMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.paris.lutece.plugins.asynchronousupload.service.IAsyncUploadHandler
addFileItemToUploadedFilesList, canUploadFiles, getHandlerName, getListUploadedFiles, removeSessionFiles
-
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:
processin interfacefr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
-
getUploadAction
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
Do remove a file of a given entry if a flag is present in the request. Files are selected from the request.- Specified by:
doRemoveFilein interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- 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:
doRemoveUploadedFilein interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- The field name of the files to removelistIndexesFilesToRemove- The list of indexes of files to remove- Returns:
- The result JSON
-
hasRemoveFlag
Check if the request has a remove flag for a given entry.- Specified by:
hasRemoveFlagin interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- 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:
isInvokedin interfacefr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
-
hasAddFileFlag
Check if the request has the flag to submit a file without submitting the form.- Specified by:
hasAddFileFlagin interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- 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:
addFilesUploadedSynchronouslyin interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- The name of the field to add files of
-
getUploadSubmitPrefix
Get the upload submit prefix- Specified by:
getUploadSubmitPrefixin interfaceIAsyncUploadHandler- Returns:
- The upload submit prefix
-
getUploadDeletePrefix
Get the upload delete prefix- Specified by:
getUploadDeletePrefixin interfaceIAsyncUploadHandler- Returns:
- The upload delete prefix
-
getUploadCheckboxPrefix
Get the upload checkbox prefix- Specified by:
getUploadCheckboxPrefixin interfaceIAsyncUploadHandler- Returns:
- The upload checkbox prefix
-
doRetrieveUploadedFile
public byte[] doRetrieveUploadedFile(jakarta.servlet.http.HttpServletRequest request) Do retrieve a file from uploaded files.- Specified by:
doRetrieveUploadedFilein interfaceIAsyncUploadHandler- 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:
getListPartialUploadedFilesin interfaceIAsyncUploadHandler- Parameters:
strFieldName- the field namesession- The session of the current user- Returns:
- the fileItem found,
nullotherwise.
-
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:
addFileItemToPartialUploadedFilesListin interfaceIAsyncUploadHandler- Parameters:
fileItem- the file itemstrFieldName- the field namerequest- the request
-
isManagePartialContent
public boolean isManagePartialContent()- Specified by:
isManagePartialContentin interfaceIAsyncUploadHandler- 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:
removeAllFileItemin interfaceIAsyncUploadHandler- 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:IAsyncUploadHandlerRemove file Item- Specified by:
removeFileItemin interfaceIAsyncUploadHandler- Parameters:
strFieldName- the field namesession- The session of the current usernIndex- 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 methodIAsyncUploadHandler.getListUploadedFiles(String, HttpSession)
-