Get Free Trial

How to ensure all data has been sent to the client side?

Fábio Magagnin asked on August 27, 2018

I’m having some issues with ‘partial data’, I need a way to ensure that all data have been sent to the client side.
I’m using a servlet to stream data to the client, as explained on the documentation:
But if any error ocurr at server side, I have no way to cancel operation, or ‘tell’ flexmonster that the data is currupted/incomplete, because since I have already flushed data – outputStream.flush() – , I can’t send an error: response.sendError()
My doubt is, how to ensure that all data has been sent to the client?

3 answers

Dmytro Zvazhii Dmytro Zvazhii Flexmonster August 28, 2018

Hello, Fabio,
Thank you for your question. Streaming the data directly into the Flexmonster is a nice approach when you are sure that nothing can go wrong on the server side. In case, the situation is different and you cannot ensure that compression was successful please consider the idea of composing the all the compressor output on the server side. We recommend either reading everything into the string or saving the result into your own buffer. If something had gone wrong and you caught an exception you can send an error response.
Please let us know if the information above was helpful for you.

Fábio Magagnin August 28, 2018

Hello Dmytro,
Your answer was helpfull, thanks, I just want to suggest for future releases some kind of validation, I mean, could exist some kind of flag at the end of the file/csv, so flexmonster front-end would know if data is partial or complete.  

Tanya Gryshko Tanya Gryshko Flexmonster August 29, 2018

Hello, Fábio,
Thank you for a quick reply!
Your suggestion sounds reasonable. We will add it to our wishlist and consider while planning the future improvements.

Please login or Register to Submit Answer