Class UploadFileHandler
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.upload.GeneratedVaadinUpload<com.vaadin.flow.component.upload.Upload>
-
- com.vaadin.flow.component.upload.Upload
-
- org.vaadin.firitin.components.upload.VUpload
-
- org.vaadin.firitin.components.upload.UploadFileHandler
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.upload.Receiver,Serializable,FluentAttachNotifier<VUpload>,FluentComponent<VUpload>,FluentDetachNotifier<VUpload>,FluentHasSize<VUpload>,FluentHasStyle<VUpload>
public class UploadFileHandler extends VUpload implements com.vaadin.flow.component.upload.Receiver
An upload implementation that just pass the input stream (and name and mime type) of the uploaded file for developer to handle.Note, then FileHandler you pass in is not executed in the UI thread. If you want to modify the UI from it, by sure to use UI.access to handle locking properly.
Note, all Upload features are not supported (but the lazy developer is not throwing exceptions on all those methods).
- Author:
- mstahv
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUploadFileHandler.FileHandler-
Nested classes/interfaces inherited from class com.vaadin.flow.component.upload.GeneratedVaadinUpload
com.vaadin.flow.component.upload.GeneratedVaadinUpload.FileRejectEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.FilesChangeEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.MaxFilesReachedChangeEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadAbortEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadBeforeEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadErrorEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadProgressEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadRequestEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadResponseEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadRetryEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadStartEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>, com.vaadin.flow.component.upload.GeneratedVaadinUpload.UploadSuccessEvent<R extends com.vaadin.flow.component.upload.GeneratedVaadinUpload<R>>
-
-
Field Summary
Fields Modifier and Type Field Description protected UploadFileHandler.FileHandlerfileHandler
-
Constructor Summary
Constructors Constructor Description UploadFileHandler(UploadFileHandler.FileHandler fileHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutputStreamreceiveUpload(String filename, String mimeType)protected voidwriteResponce(PipedInputStream in, String filename, String mimeType)By default just spans a new raw thread to get the input.-
Methods inherited from class org.vaadin.firitin.components.upload.VUpload
withAcceptedFileTypes, withAllFinishedListener, withAutoUpload, withDropAllowed, withDropLabel, withDropLabelIcon, withFailedListener, withFileRejectedListener, withFinishedListener, withI18n, withMaxFiles, withMaxFileSize, withProgressListener, withStartedListener, withSucceededListener, withUploadButton
-
Methods inherited from class com.vaadin.flow.component.upload.Upload
addAllFinishedListener, addFailedListener, addFileRejectedListener, addFinishedListener, addProgressListener, addStartedListener, addSucceededListener, fireUpdateProgress, getAcceptedFileTypes, getDropLabel, getDropLabelIcon, getI18n, getMaxFiles, getMaxFileSize, getReceiver, getUploadButton, interruptUpload, isAutoUpload, isDropAllowed, isUploading, setAcceptedFileTypes, setAutoUpload, setDropAllowed, setDropLabel, setDropLabelIcon, setI18n, setMaxFiles, setMaxFileSize, setReceiver, setUploadButton
-
Methods inherited from class com.vaadin.flow.component.upload.GeneratedVaadinUpload
addFileRejectListener, addFilesChangeListener, addMaxFilesReachedChangeListener, addToAddButton, addToDropLabel, addToDropLabelIcon, addToFileList, addUploadAbortListener, addUploadBeforeListener, addUploadErrorListener, addUploadProgressListener, addUploadRequestListener, addUploadResponseListener, addUploadRetryListener, addUploadStartListener, addUploadSuccessListener, getAcceptString, getCaptureString, getFilesJsonArray, getFormDataNameString, getHeadersJsonObject, getI18nJsonObject, getMaxFilesDouble, getMaxFileSizeDouble, getMethodString, getTargetString, getTimeoutDouble, isMaxFilesReachedBoolean, isNoAutoBoolean, isNodropBoolean, isWithCredentialsBoolean, remove, removeAll, setAccept, setCapture, setFiles, setFormDataName, setHeaders, setI18n, setMaxFiles, setMaxFileSize, setMethod, setNoAuto, setNodrop, setTarget, setTimeout, setWithCredentials, uploadFiles
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.vaadin.firitin.fluency.ui.FluentAttachNotifier
withAttachListener
-
Methods inherited from interface org.vaadin.firitin.fluency.ui.FluentComponent
setId, setVisible, withId, withVisible
-
Methods inherited from interface org.vaadin.firitin.fluency.ui.FluentDetachNotifier
withDetachListener
-
Methods inherited from interface org.vaadin.firitin.fluency.ui.FluentHasSize
withFullHeight, withFullWidth, withHeight, withMaxHeight, withMaxSize, withMaxWidth, withMinHeight, withMinSize, withMinWidth, withSize, withSizeFull, withSizeUndefined, withWidth
-
Methods inherited from interface org.vaadin.firitin.fluency.ui.FluentHasStyle
withAddedClassName, withClassName, withStyle
-
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
-
-
-
-
Field Detail
-
fileHandler
protected final UploadFileHandler.FileHandler fileHandler
-
-
Constructor Detail
-
UploadFileHandler
public UploadFileHandler(UploadFileHandler.FileHandler fileHandler)
-
-
Method Detail
-
receiveUpload
public OutputStream receiveUpload(String filename, String mimeType)
- Specified by:
receiveUploadin interfacecom.vaadin.flow.component.upload.Receiver
-
writeResponce
protected void writeResponce(PipedInputStream in, String filename, String mimeType)
By default just spans a new raw thread to get the input. For strict Java EE fellows, this might not suite, so override and use executor service.- Parameters:
in- the input stream where file content can be handledfilename- the file name on the senders machinemimeType- the mimeType interpreted from the file name
-
-