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 aFilethat is generated by the givenFileFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected TransferContextgetTransferContext(UploadEvent transferEvent) This method is used to get the transfer context from the transfer events (e.g.voidhandleUploadRequest(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, setTransferUI, whenComplete, whenComplete, whenStart, whenStartMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.server.streams.ElementRequestHandler
getDisabledUpdateMode, getUrlPostfix, isAllowInertMethods 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 aFilethat is generated by the givenFileFactory.- Parameters:
successCallback- consumer to be called for successful uploadfileFactory- factory that generates theFileto store data
-
-
Method Details
-
handleUploadRequest
Description copied from interface:UploadHandlerMethod 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:
handleUploadRequestin 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:TransferProgressAwareHandlerThis method is used to get the transfer context from the transfer events (e.g.DownloadEvent).- Specified by:
getTransferContextin classTransferProgressAwareHandler<UploadEvent,R extends AbstractFileUploadHandler> - Parameters:
transferEvent- the transfer event- Returns:
- the transfer context
-