-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Micheal,
Michael Ludwig wrote: > Your argument in favour of the unified buffer sounds perfectly logical > to me. In the end, it's all bytes that get written, regardless of > whether or not I wrap a PrintWriter around the buffer. There's always the case that some output has been written before your filter has been called. In that case, you have to make sure that your output goes to the correct place. That may mean turning your Writer contents into an OutputStream, or vice-versa. I think it's simpler to wrap whichever object the caller is actually requesting. > I possibly also have to make sure to play by the same rules as the real > implementation and not allow both getWriter() and getOutputStream() on > the same resonse. That's not hard: just make sure you call the wrapped request's getWriter or getInputStream from your own implementations of the same methods. > And what do you mean by "caching" it? Just keeping it in an instance > variable, instead of erroneously creating a new one for each call of > getWriter(), as I first did? Yes. > I agree: You never know. And who knows what stuff gets set or tweaked in > Tomcat's internals for each one of getWriter() and getOutputStream(). On > the other hand, I haven't found any statement to the effect that you > have to pass through the calls to the underlying response object. No, you don't have to do this, but the benefit of doing it is that you have the wrapped request enforcing the "call either getWriter or getInputStream" requirement. The rule in filters is: only implement what you actually need. Wrap, baby, wrap. ;) - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkksDDUACgkQ9CaO5/Lv0PDQDwCeL79aNLp4UvJ43UXGU8zHmBqn HncAn16MaJnKWEDkLQMez+k+44mE8u61 =8el8 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]