public static int setResponseContentLength ( HttpServletResponse response , String s ) throws UnsupportedEncodingException { int length = s . getBytes ( response . getCharacterEncoding ( ) ) . length ; response . setContentLength ( length ) ; return length ; }
Set the proper content length for the string