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,

Saurav

Below is the servlet or server side code



        response.setContentLength((int)length);

      }

      else

      {

        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) {

        random.nextBytes(buffer);

        outputStream.write(buffer);

        size += 1;

      }


      outputStream.flush();


      return;

    }

}catch (Exception e) {

e.printStackTrace();

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

return;

}

  }

Reply via email to