-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael,
Michael Larson wrote: > I'm debugging a tomcat filter. The filter has been designed as follows: > > MyFilter::DoFilter(ServletRequest request, ServletResponse response, > FilterChain chain) > { > do_some_stuff(); > > //now delegate the call the chain > chain.DoFilter(); > > //the header value below doesn't always show up at the client > response.setHeader("post-filter","true"); > } This might not work because the response could have been committed. If the response buffer is filled, then the headers will be sent back to the client. If you come along later and try to set a header, you'll get an exception. > For the jsp page being accessed I've turned off AutoFlush (via a server > side directive). However, I'm still seeing this page (if it exceeds a > certain size but well below the jspwriter buffer size) will be sent back > to the client before the response header has been modified. I'm not sure about autoFlush, but it may be that you're hitting a hard buffer limit and the data is being sent, anyway. > If AutoFlush is turned off for the jsp page and the page doesn't exceed > the buffer size can it still send the response back to the client before > the filter chain has completed (and in this example before the header > has been modified)? Is it a bad idea to modify the response header after > the call to chain.DoFilter()? It's much better to do it up front if you can. Why do you need the header to be set after the fact? If you really must do this, you can always do your own buffering by wrapping the request along with your own OutputStream/Writer that buffers itself. > The version of tomcat is v5.5.23, and no exceptions are thrown when the > setHeader call is made. That's interesting that no exceptions are thrown. :( - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjrrxwACgkQ9CaO5/Lv0PAKdwCfbEXaoIj5cnMLIYZciiEXcAL8 0TMAn0CWqgdA8qQNsZwDabIQHbRHPoqY =Gqzj -----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]