-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 3/20/19 10:48, Saurav Sarkar wrote: > Thanks a lot Olaf for the response. > > Yes , i have taken care of that condition > > Please find the full code below > > protected void doGet(HttpServletRequest request, > HttpServletResponse response) > > throws ServletException, IOException { > > try { > > String param = request.getParameter("size"); > > if (param != null) { > > > int kByte = Integer.parseInt(param); > > > response.setContentType("application/octet-stream"); > > > > long length = kByte * 1024; > > if (length <= Integer.MAX_VALUE) > > { > > response.setContentLength((int)length); > > } > > else > > { > > response.addHeader("Content-Length", Long.toString(length)); > > } Why not simply always use: response.setContentLengthLong(length); ? > // response.setContentLength(kByte * 1024); > > > ServletOutputStream outputStream = response.getOutputStream(); > > byte[] buffer = new byte[1024]; > > Random random = new Random(System.currentTimeMillis()); > > > > > while (size < kByte) { > > random.nextBytes(buffer); > > outputStream.write(buffer); > > size += 1; > > } > > > outputStream.flush(); > > > return; > > } The error you are getting is ClientAbortException. That means that the client terminated the connection. Perhaps the client didn't want to accept some huge response. This is not a server-side error. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlySWUcACgkQHPApP6U8 pFjGbBAAgaxhw5B5LwR4Q4/9qvmqIESY+O8RGVF94zzg0derL95BQ/8R4hcV1723 H9LBiHjY1/ZCODCZdOXL8bqCwNYhfE33uXCEXXbNiE4i9SKpAT9yhejZayaJ6oDw hXv8X7gYZlG8xGwvuVaQ1qrmqeNOLsLcl0hyPjUe2HVZoWgzX5c+WIGvQpGqNLHu 4j+UQsXm+7ALC3vb29S+odvP4qZWf9yEDqQ1RgwbQ499ILM6SGuvYkTQmAeDKGWS zetAAfjUUhnNZF5qe5QIJkXJZrfPahclmidAqDwA1anb00SsNTmNvmHsPNYWqnC4 2Xnhv3QVZs3PJ66+jZbbBcAkHoyTeDhHGUc1P657MakI//3xViwxAwR0BZwpDCui VVnk0HISCgv57GQW/C+haGRNQL6bTI8dnhIy0z76tmyUoyNmMLs1HIGSgKmhLYTj VHlqP/9WzE8FSRXZJJv2wqh2bVwecTKSvmouDGZ5O3c5wweO5HCLfEXz4Bv8yAxJ x7ugFit0IC01ZvkwD7oJH0eCVibRA1kQoy5vxTy28Vypchv1EmVNNHKax/6EMCZu kSKK1BOmRV8q4Ut4SRC7H8WdpvCxK5sftHbOkklt8/2wfgmSRkBHDufDe/P0h5av NQ0QcSGRORLVJ0uEgIF38PmASwqS1f4bla7W2IQfg/0tCSyp9yU= =H7Jd -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org