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.IAsynchronousUploadHandler2Interface 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 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 filesvoidaddFileItemToUploadedFilesList(org.apache.commons.fileupload.FileItem fileItem, java.lang.String strFieldName, javax.servlet.http.HttpServletRequest request)Add a file item to the list of uploaded filesvoidaddFilesUploadedSynchronously(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)Add files uploaded synchronously for a given fieldjava.lang.StringcanUploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName, java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload, java.util.Locale locale)Check if the file can be uploaded or not.voiddoRemoveFile(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.lang.StringgetHandlerName()Get the name of the handler.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.util.List<org.apache.commons.fileupload.FileItem>getListUploadedFiles(java.lang.String strFieldName, javax.servlet.http.HttpSession session)Gets the list of upload files for a given field and a given session.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.booleanisManagePartialContent()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 Itemdefault voidremoveSessionFiles(javax.servlet.http.HttpSession session)Removes all files associated to the session
-
-
-
Method Detail
-
getUploadSubmitPrefix
java.lang.String getUploadSubmitPrefix()
Get the upload submit prefix- Returns:
- The upload submit prefix
-
getUploadDeletePrefix
java.lang.String getUploadDeletePrefix()
Get the upload delete prefix- Returns:
- The upload delete prefix
-
getUploadCheckboxPrefix
java.lang.String getUploadCheckboxPrefix()
Get the upload checkbox prefix- Returns:
- The upload checkbox prefix
-
canUploadFiles
java.lang.String canUploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName, java.util.List<org.apache.commons.fileupload.FileItem> listFileItemsToUpload, java.util.Locale locale)Check if the file can be uploaded or not.- Parameters:
request- The requeststrFieldName- the field namelistFileItemsToUpload- the list of files to uploadlocale- the locale- Returns:
- The error message if any, or null if the files can be uploaded.
-
getListUploadedFiles
java.util.List<org.apache.commons.fileupload.FileItem> getListUploadedFiles(java.lang.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 namesession- The session of the current user- Returns:
- the fileItem found,
nullotherwise.
-
getListPartialUploadedFiles
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.- Parameters:
strFieldName- the field namesession- The session of the current user- Returns:
- the fileItem found,
nullotherwise.
-
removeFileItem
void removeFileItem(java.lang.String strFieldName, javax.servlet.http.HttpSession session, int nIndex)Remove file Item- 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 methodgetListUploadedFiles(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, java.lang.String strFieldName, javax.servlet.http.HttpServletRequest request)Add a file item to the list of uploaded files- Parameters:
fileItem- the file itemstrFieldName- the field namerequest- the request
-
addFileItemToPartialUploadedFilesList
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- Parameters:
fileItem- the file itemstrFieldName- the field namerequest- the request
-
hasRemoveFlag
boolean hasRemoveFlag(javax.servlet.http.HttpServletRequest request, java.lang.String strFieldName)Check if the request has a remove flag for a given entry.- Parameters:
request- The requeststrFieldName- 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, 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.- Parameters:
request- The requeststrFieldName- The field name
-
doRemoveUploadedFile
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.- Parameters:
request- The requeststrFieldName- The field name of the files to removelistIndexesFilesToRemove- The list of indexes of files to remove- Returns:
- The result JSON
-
hasAddFileFlag
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.- Parameters:
request- The requeststrFieldName- 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, java.lang.String strFieldName)Add files uploaded synchronously for a given field- Parameters:
request- The requeststrFieldName- The name of the field to add files of
-
getHandlerName
java.lang.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
-
-