Class AsynchronousUploadHandler
java.lang.Object
fr.paris.lutece.plugins.asynchronousupload.service.AbstractAsynchronousUploadHandler
fr.paris.lutece.plugins.asynchronousupload.service.AsynchronousUploadHandler
- All Implemented Interfaces:
IAsyncUploadHandler,fr.paris.lutece.portal.web.upload.IAsynchronousUploadHandler2
@ApplicationScoped
@Named("asynchronous-upload.asynchronousUploadHandler")
public class AsynchronousUploadHandler
extends AbstractAsynchronousUploadHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileItemToUploadedFilesList(fr.paris.lutece.portal.service.upload.MultipartItem fileItem, String strFieldName, jakarta.servlet.http.HttpServletRequest request) Add a file item to the list of uploaded filescanUploadFiles(jakarta.servlet.http.HttpServletRequest request, String strFieldName, List<fr.paris.lutece.portal.service.upload.MultipartItem> listFileItemsToUpload, Locale locale) Check if the file can be uploaded or not.static AsynchronousUploadHandlerDeprecated.Get the name of the handler.List<fr.paris.lutece.portal.service.upload.MultipartItem>getListUploadedFiles(String strFieldName, jakarta.servlet.http.HttpSession session) Gets the list of upload files for a given field and a given session.voidremoveSessionFiles(jakarta.servlet.http.HttpSession session) Cleans up all files associated with the specified session.Methods inherited from class fr.paris.lutece.plugins.asynchronousupload.service.AbstractAsynchronousUploadHandler
addFileItemToPartialUploadedFilesList, addFilesUploadedSynchronously, doRemoveFile, doRemoveUploadedFile, doRetrieveUploadedFile, getListPartialUploadedFiles, getUploadAction, getUploadCheckboxPrefix, getUploadDeletePrefix, getUploadSubmitPrefix, hasAddFileFlag, hasRemoveFlag, isInvoked, isManagePartialContent, process, removeFileItem
-
Constructor Details
-
AsynchronousUploadHandler
public AsynchronousUploadHandler()
-
-
Method Details
-
getHandler
Deprecated.Use@Injectto obtain theAsynchronousUploadHandlerinstance. This method will be removed in future versions.Get the handlerThis method is deprecated and is provided for backward compatibility only. For new code, use dependency injection with
@Injectto obtain theAsynchronousUploadHandlerinstance instead.- Returns:
- the handler
-
canUploadFiles
public String canUploadFiles(jakarta.servlet.http.HttpServletRequest request, String strFieldName, List<fr.paris.lutece.portal.service.upload.MultipartItem> listFileItemsToUpload, Locale locale) Description copied from interface:IAsyncUploadHandlerCheck 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
public List<fr.paris.lutece.portal.service.upload.MultipartItem> getListUploadedFiles(String strFieldName, jakarta.servlet.http.HttpSession session) Description copied from interface:IAsyncUploadHandlerGets 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.
-
addFileItemToUploadedFilesList
public void addFileItemToUploadedFilesList(fr.paris.lutece.portal.service.upload.MultipartItem fileItem, String strFieldName, jakarta.servlet.http.HttpServletRequest request) Description copied from interface:IAsyncUploadHandlerAdd a file item to the list of uploaded files- Parameters:
fileItem- the file itemstrFieldName- the field namerequest- the request
-
getHandlerName
Description copied from interface:IAsyncUploadHandlerGet 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
-
removeSessionFiles
public void removeSessionFiles(jakarta.servlet.http.HttpSession session) Cleans up all files associated with the specified session. Implementations must delete each physical temporary file, typically by callingMultipartItem.delete(), and remove the corresponding session entry from their internal file-item map as part of the same cleanup operation.- Parameters:
session- the terminated session
-
@Injectto obtain theAsynchronousUploadHandlerinstance.