tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurav Sarkar <>
Subject Default Max response size in Tomcat
Date Wed, 20 Mar 2019 10:21:53 GMT
Hi All

I have a very basic test application which serves bytes from memory and
gives it back to the client.

Whenever i try to send the request for byte size which is of over 2 GB i
get a connection reset error in my server code and a 502 error in my chrome
console. Below 2 GB it is working fine.

In my client side i execute java script which i execute from the browser.
This basically executes an XMLHTTPRequest , gets the response (stores in
browser memory) and asks for a save.

I would like to know if there Is there max response size default value
which is set in default tomcat configuration. ? or any other hints which
you can provide in my use.

Thanks and Regards,


Below is the servlet or server side code





        response.addHeader("Content-Length", Long.toString(length));


     // response.setContentLength(kByte * 1024);

      ServletOutputStream outputStream = response.getOutputStream();

      byte[] buffer = new byte[1024];

      Random random = new Random(System.currentTimeMillis());

      long size = 0;

      while (size < kByte) {



        size += 1;





}catch (Exception e) {


response.sendError(500, e.getMessage());




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message