#29430

In the servlet code I would try also to return a content lengths in HTTP header.

For that, you would probably need to print image to a ByteArrayOutputStream, measure resulting byte array length, set headers and only after that send it to HTTP output stream.