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 java.lang.Object implements IAsyncUploadHandler
AbstractAsynchronousUploadHandler.
-
-
Constructor Summary
Constructors Constructor Description AbstractAsynchronousUploadHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFileItemToPartialUploadedFilesList(org.apache.commons.fileupload.FileItem fileItem, java.lang.String strFieldName, javax.servlet.http.HttpServletRequest request)Add file item to the list of partial uploaded filesvoidaddFilesUploadedSynchronously(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)Add files uploaded synchronously for a given fieldvoiddoRemoveFile(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.StringdoRemoveUploadedFile(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.StringgetUploadAction(javax.servlet.http.HttpServletRequest request)Checks the request parameters to see if an upload submit has been called.java.lang.StringgetUploadCheckboxPrefix()Get the upload checkbox prefixjava.lang.StringgetUploadDeletePrefix()Get the upload delete prefixjava.lang.StringgetUploadSubmitPrefix()Get the upload submit prefixbooleanhasAddFileFlag(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)Check if the request has the flag to submit a file without submitting the form.booleanhasRemoveFlag(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)Check if the request has a remove flag for a given entry.booleanisInvoked(javax.servlet.http.HttpServletRequest request)booleanisManagePartialContent()voidprocess(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)voidremoveAllFileItem(javax.servlet.http.HttpSession session)Remove all file Item for a given sessionvoidremoveFileItem(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
-
Methods inherited from interface fr.paris.lutece.plugins.asynchronousupload.service.IAsyncUploadHandler
addFileItemToUploadedFilesList, canUploadFiles, getHandlerName, getListUploadedFiles, removeSessionFiles
-
-
-
-
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:
processin interfacefr.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:
doRemoveFilein interfaceIAsyncUploadHandler- Parameters:
request- The requeststrFieldName- 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:
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
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:
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
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:
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, java.lang.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
public java.lang.String getUploadSubmitPrefix()
Get the upload submit prefix- Specified by:
getUploadSubmitPrefixin interfaceIAsyncUploadHandler- Returns:
- The upload submit prefix
-
getUploadDeletePrefix
public java.lang.String getUploadDeletePrefix()
Get the upload delete prefix- Specified by:
getUploadDeletePrefixin interfaceIAsyncUploadHandler- Returns:
- The upload delete prefix
-
getUploadCheckboxPrefix
public java.lang.String 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 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:
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, java.lang.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)
Remove all file Item for a given session- Specified by:
removeAllFileItemin interfaceIAsyncUploadHandler- Parameters:
session- The session of the current user
-
removeFileItem
public void removeFileItem(java.lang.String strFieldName, javax.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)
-
-