Accessing the session from @RestController

Hi,

I might be on the wrong track with the description in my title, but here is what I want to do:

I have a video component that accepts a URL, so I want the browser to initiate the call to get the video file.
Now, when getting the file, I would like that RestController that is currently serving these files is aware of the Vaadin session from where it was requested.

When initiating the spring RestController bean I get an exception that the session can not be wired in because it’s not available on that thread.

Is there a way to let Vaadin serve that video byte stream instead of having to go to a Spring RestController?
I’m on Vaadin 14 currently. Vaadin 17’s @Endpoint look promising, but before migrating I just want to check if this is possible in 14.

Thanks

You can use a StreamResource to serve resource requests dynamically. See https://vaadin.com/docs/v14/flow/advanced/tutorial-dynamic-content.html#using-code-streamresource-code for more information.