You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/02/09 21:21:58 UTC
DO NOT REPLY [Bug 50747] CometProcessor does not flush and close
HTTP/1.0 requests
https://issues.apache.org/bugzilla/show_bug.cgi?id=50747
Frank Schroeder <fr...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version| |All
--- Comment #1 from Frank Schroeder <fr...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org