public class FileUploadManager extends Object implements Serializable, javax.servlet.http.HttpSessionBindingListener, org.opensingular.lib.commons.util.Loggable
| Modifier and Type | Field and Description |
|---|---|
static String |
SESSION_KEY |
| Constructor and Description |
|---|
FileUploadManager() |
| Modifier and Type | Method and Description |
|---|---|
<R> Optional<R> |
consumeFile(String fid,
Function<IAttachmentRef,R> callback) |
FileUploadInfo |
createFile(UploadInfo uploadInfo,
String fileName,
InputStream input) |
AttachmentKey |
createUpload(Long maxFileSize,
Integer maxFileCount,
Collection<String> allowedFileTypes,
TemporaryAttachmentPersistenceHandlerSupplier temporaryAttachmentPersistenceHandlerSupplier)
Cria um contexto de upload na servlet, atribiuindo os metadados necessarios a session
|
Optional<UploadInfo> |
findUploadInfoByAttachmentKey(AttachmentKey uploadId) |
protected AttachmentKeyFactory |
makeAttachmentKeyFactory() |
protected FileUploadInfoRepository |
makeFileUploadInfoRepository() |
protected UploadInfoRepository |
makeUploadInfoRepository() |
protected UploadPathHandler |
makeUploadPathHandler() |
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event) |
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) |
public static final String SESSION_KEY
protected AttachmentKeyFactory makeAttachmentKeyFactory()
protected UploadInfoRepository makeUploadInfoRepository()
protected UploadPathHandler makeUploadPathHandler()
protected FileUploadInfoRepository makeFileUploadInfoRepository()
public AttachmentKey createUpload(Long maxFileSize, Integer maxFileCount, Collection<String> allowedFileTypes, TemporaryAttachmentPersistenceHandlerSupplier temporaryAttachmentPersistenceHandlerSupplier)
maxFileSize - tamanho do arquivomaxFileCount - maximo de arquivosallowedFileTypes - os tipos permitidospublic Optional<UploadInfo> findUploadInfoByAttachmentKey(AttachmentKey uploadId)
public <R> Optional<R> consumeFile(String fid, Function<IAttachmentRef,R> callback)
public FileUploadInfo createFile(UploadInfo uploadInfo, String fileName, InputStream input) throws IOException
IOExceptionpublic void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
valueBound in interface javax.servlet.http.HttpSessionBindingListenerpublic void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
valueUnbound in interface javax.servlet.http.HttpSessionBindingListenerCopyright © 2017. All rights reserved.