Package com.vaadin.flow.server.streams
Class AbstractFileUploadHandler<R extends AbstractFileUploadHandler>
java.lang.Object
com.vaadin.flow.server.streams.TransferProgressAwareHandler<UploadEvent,R>
com.vaadin.flow.server.streams.AbstractFileUploadHandler<R>
- Type Parameters:
R
- type of file upload handler
- All Implemented Interfaces:
ElementRequestHandler
,UploadHandler
,Serializable
- Direct Known Subclasses:
FileUploadHandler
,TemporaryFileUploadHandler
public abstract class AbstractFileUploadHandler<R extends AbstractFileUploadHandler>
extends TransferProgressAwareHandler<UploadEvent,R>
implements UploadHandler
Abstract class for file upload handler.
- Since:
- 24.8
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractFileUploadHandler
(FileUploadCallback successCallback, FileFactory fileFactory) Creates an upload callback that stores the incoming stream into aFile
that is generated by the givenFileFactory
. -
Method Summary
Modifier and TypeMethodDescriptionprotected TransferContext
getTransferContext
(UploadEvent transferEvent) This method is used to get the transfer context from the transfer events (e.g.void
handleUploadRequest
(UploadEvent event) Method that is called when the client wants to upload data to the url stored for this specific handler registration.Methods inherited from class com.vaadin.flow.server.streams.TransferProgressAwareHandler
addTransferProgressListener, getListeners, notifyError, onProgress, onProgress, onProgress, onProgress, whenComplete, whenComplete, whenStart, whenStart
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.server.streams.ElementRequestHandler
getDisabledUpdateMode, getUrlPostfix, isAllowInert
Methods inherited from interface com.vaadin.flow.server.streams.UploadHandler
getFileCountMax, getFileSizeMax, getRequestSizeMax, handleRequest, responseHandled
-
Constructor Details
-
AbstractFileUploadHandler
Creates an upload callback that stores the incoming stream into aFile
that is generated by the givenFileFactory
.- Parameters:
successCallback
- consumer to be called for successful uploadfileFactory
- factory that generates theFile
to store data
-
-
Method Details
-
handleUploadRequest
Description copied from interface:UploadHandler
Method that is called when the client wants to upload data to the url stored for this specific handler registration.After upload of all files is done the method
UploadHandler.responseHandled(boolean, VaadinResponse)
will be called.- Specified by:
handleUploadRequest
in interfaceUploadHandler
- Parameters:
event
- upload event containing the necessary data for getting the request- Throws:
IOException
- if an error occurs during upload
-
getTransferContext
Description copied from class:TransferProgressAwareHandler
This method is used to get the transfer context from the transfer events (e.g.DownloadEvent
).- Specified by:
getTransferContext
in classTransferProgressAwareHandler<UploadEvent,
R extends AbstractFileUploadHandler> - Parameters:
transferEvent
- the transfer event- Returns:
- the transfer context
-