Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Using StreamReceiver to Receive an Incoming Data Stream

Using StreamReceiver to receive an incoming data stream.

To receive an upload from the client, you need to register a StreamReceiver that accepts a URL to handle receiving an upload stream.

To create a StreamReceiver, you first need to create a StreamVariable that monitors and controls terminal upload during the time it’s being streamed.

Then the stream can be registered through the Element API.

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