When the setContentLength
method is used to set the length of the response with a higher size that is higher than the actual size, why is the container not auto calculating the length?
for instance,
String s = "hello";
byte[] b = s.getBytes();
response.setContentLength(100);
response.getOutputStream().write(b);
response.flush();
When i hit the servlet, it takes about half a minute to load the page, is this because of the content length header..?
What is the need for such a method? why cant the container be made to calculate the length of the response by itself?