https://issues.apache.org/bugzilla/show_bug.cgi?id=50747

Frank Schroeder <frank.schroe...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from Frank Schroeder <frank.schroe...@gmail.com> 2011-02-09 
15:21:54 EST ---
I've found the problem. The following sequence works with HTTP/1.1 but not with
HTTP/1.0. I guess I've made a classical optimization mistake. This also
explains why the content length and encoding headers were never set.


String data = "...";
PrintWriter writer = response.getWriter();
response.setStatus(200);
response.setCharacterEncoding("UTF-8");
response.setContentLength(data.length());
writer.write(data);
writer.flush();
event.close();

Getting the Writer *after* setting the response headers makes it all work

String data = "...";
response.setStatus(200);
response.setCharacterEncoding("UTF-8");
response.setContentLength(data.length());
PrintWriter writer = response.getWriter();
writer.write(data);
writer.flush();
event.close();

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to