tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Spec conflict between ServletResponse.getWriter() and ServletResponse.reset()
Date Fri, 02 Mar 2007 04:18:04 GMT
Looking into bug 37072 has identified a conflict in the spec.

Consider the following sequence of calls:


After this the writer encoding and response encoding do not agree and
can not be reconciled:
- the Writer is using UTF-8 because the reset only clears the buffer,
it doesn't reset the writer's encoding
- response.getCharacterEncoding returns ISO-8859-1 due to the reset
- response.setCharacterEncoding has no effect since the getWriter()
call sets the usingWriter flag that prevents changes to the character

The spec is clear that:
- reset() clear all the headers
- calls setCharacterEncoding() have no effect after getWriter()

What isn't clear is should the call to reset() also clear the writer
(assuming of course that the response isn't committed)? Along the same
lines is getWriter(), reset(), getStream() be legal?

I am minded to clear the writer, buffer, stream and associated flags
on reset().



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message