Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

StreamReceiver for receiving incoming data stream

To receive upload from the client we need to register a StreamReceiver that will get a URL that will handle receiving of an upload stream.

For creating a StreamReceiver we first need to create a StreamVariable that handles terminal Upload monitors and controls the upload during the time it is being streamed.

Then the stream can be registered through the Element API.

StreamReceiver streamReceiver = new StreamReceiver(
    getElement().getNode(), "upload", getStreamVariable());
getElement().setAttribute("target", streamReceiver);