tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Filter access to response object [was Re: domain-wide session cookies?]
Date Tue, 25 Mar 2003 05:32:07 GMT


On Mon, 24 Mar 2003, Aditya wrote:

> Date: Mon, 24 Mar 2003 17:07:43 -0800
> From: Aditya <aditya@grot.org>
> Reply-To: Tomcat Developers List <tomcat-dev@jakarta.apache.org>
> To: Tomcat Developers List <tomcat-dev@jakarta.apache.org>
> Subject: Filter access to response object [was Re: domain-wide session
>     cookies?]
>
> > On Mon, 24 Mar 2003 14:10:59 -0800 (PST), "Craig R. McClanahan" <craigmcc@apache.org>
said:
> > Sharing a session across virtual hosts violates the Servlet spec
> > (Section 7.3 - "HttpSession objects must be scoped at the
> > application (or servlet context) level" and Section 3.6 - "Servlet
> > contexts can not be shared across virtual hosts"), so you should not
> > really be surprised to find the logic for setting up a session
> > cookie be hard coded in the manner you describe.
>
> Okay, you're right, that violates the spec. So please forget I asked
> (grin).
>

:-)

> Instead, what is now troubling me is that it seems that Tomcat adds
> HTTP headers to the response object *after* all filters have been
> applied. AFAICT, the spec does not explictly comment on this and so
> I'm assuming it is a detail left to the implementator.
>
> Here's my problem:
>
> - I have a single filter that essentially does:
>
> doFilter(...)
>   do stuff to request object...
>   chain.doFilter(..);
>   do stuff to response object...
> }
>
> however, it seems that Tomcat adds response headers _after_ the
> filter, is there a reason for that? I'd like to manipulate *ALL* the
> headers in the response object with my filter...
>

Since Tomcat adds its last headers when the response is committed (because
otherwise they would not be able to be added), why not just add a call to:

  response.flushBuffer();

before the line that says:

  "do stuff to response object..."

?

> Adi

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message