tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50747] CometProcessor does not flush and close HTTP/1.0 requests
Date Wed, 09 Feb 2011 20:21:58 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50747

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

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

--- Comment #1 from Frank Schroeder <frank.schroeder@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


Mime
View raw message