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(org.apache.commons.fileupload.FileItem fileItem, String strFieldName, javax.servlet.http.HttpServletRequest request) Add file item to the list of partial uploaded filesvoidaddFilesUploadedSynchronously(javax.servlet.http.HttpServletRequest request, String strFieldName) Add files uploaded synchronously for a given fieldvoiddoRemoveFile(javax.servlet.http.HttpServletRequest request, String strFieldName) Do remove a file of a given entry if a flag is present in the request.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.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.getUploadAction(javax.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(javax.servlet.http.HttpServletRequest request, String strFieldName) Check if the request has the flag to submit a file without submitting the form.booleanhasRemoveFlag(javax.servlet.http.HttpServletRequest request, String strFieldName) Check if the request has a remove flag for a given entry.booleanisInvoked(javax.servlet.http.HttpServletRequest request) booleanvoidprocess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String, Object> map, List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload) voidremoveAllFileItem(javax.servlet.http.HttpSession session) Deletes the physical temporary files uploaded during the specified session.voidremoveFileItem(String strFieldName, javax.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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Map<String, Object> map, List<org.apache.commons.fileupload.FileItem> 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(javax.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(javax.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(javax.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(javax.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<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.- Specified by:
getListPartialUploadedFilesin interfaceIAsyncUploadHandler- Parameters:
strFieldName- the field namesession- The session of the current user- Returns:
- the fileItem found,
nullotherwise.
-
addFileItemToPartialUploadedFilesList
public 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- 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(javax.servlet.http.HttpSession session) Deletes the physical temporary files uploaded during the specified session.- Specified by:
removeAllFileItemin interfaceIAsyncUploadHandler- Parameters:
session- the current session
-
removeFileItem
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)
-