I am trying to use the upload dialog but i was wondering what steps need to be taken to make sure the data is not uploaded to the vaadin server but the stream is redirected to an external resource for which an API is available.
Do i need to make a public class iRODSReceiver implements Receiver { and is there an example of how this should look like?
once the upload to the vaadin application is finished. Which method should or shoud i? override to start a function once the stream has received so i can “hijack” its destination?
@Override
public OutputStream receiveUpload(String filename, String mimeType) {
try {
// Define the path where the file will be saved
File file = new File("path/to/save/" + filename);
return new FileOutputStream(file);
} catch (Exception e) {
// Handle exceptions appropriately
e.printStackTrace();
return null;
}
}
}```
but then again it only calls this function once the file is uploaded to the vaadin instance hmm
I’m slighlty confused, so a question Are you trying to push the stream of the bytes coming from the uploaded file to a service/API in your application server where your Vaadin app is running OR would you like the browser to submit the files to a totally different URL/server?
and it would be a waste to first store it on a vaadin instance (with minimal storage space) and then push it to the resource (this also will take twice as long)
In the streaming solution, we turn the setup upside down, again, and this way we get more optimal API for dynamic purposes. We pipe one stream to another and provide the piped version forward.