I am currently implementing a file upload service in java using jetty as my servelet container. I am facing an issue I want to get fixed.
I have an endpoint for the file upload which is a post endpoint which takes multipart form data.
This works fine for small files but gives me a headache when a user uploads a big file. If I am not wrong then Jetty Buffers the uploaded file before forwarding it to my FileInputStream
.
By this I mean that it fills its internal buffer first and then writes it to the FileInputStream
. Is there a way to stop this and tweak jetty that it directly relays the data to the FileInputStream
before buffering it?
I already tried to wrap the input stream into a buffered one but still, Jetty first consumes the file, buffers it and then writes it to the InputStream
.
After some research, I saw a comment suggesting to use put instead and then access the raw data to achieve this direct forwarding. But I was wondering if there is another maybe even better way.
Regards Artur