Konstantin Kolinko <knst.kolinko <at> gmail.com> writes:

.
> 
> Do you observe any pattern in which responses 
have the headers and which do not?
> 
> For me a caveat was that the URI must match not only the urirewrite
> rules, but also the filter mapping in web.xml, where this filter is
> defined.
> 

> 
> I used from + set without "to" and it worked.
> 
> Best regards,
> Konstantin Kolinko
> 


I've tried to follow the advice here with UrlRewriteFilter 
and also tried the other approach suggested in this thread 
by writing my own servlet filter.
With uri rewrite, I have changed my rule to 
<rule>  
     <from>^(.*)$</from>
     <to>$1</to>
     <set type="response-header" name="P3P">CP="NOI DSP COR"</set>
</rule>
Changed my logLevel to TRACE, in my web.xml.
Some of my servlets get the P3P, but not all. I haven't been able to 
identify a pattern of why yet. All the images, css, 
and other static resources did not get the P3P header.

I tried a different approach. Instead of using UrlRewriteFilter, 
I wrote my own servlet filter.
Adding the P3P header before and after calling 
the FilterChain's doFilter method. i.e.
httpResponse.addHeader("P3P", "CP=\"NOI DSP COR \"");
a_chain.doFilter(a_request, a_response);
httpResponse.addHeader("P3P", "CP=\"NOI DSP COR \"");

Then implemented this filter in my tomcat global web.xml under conf/. 
I was able to get the P3P header in all my static resources 
such as images, css. I could also get the
P3P header in most of my servlets except for a few.

Seems to me, I should only need to add headers after 
the response object has returned from the FilterChain.doFilter. 
If someone has any idea why I had to add headers before 
FilterChain.doFilter, it may shed some lights
to why I still have a few servlets not getting the P3P headers.
Or why some servlets get the P3P when we added it
before the FilterChain and some get it when we added 
P3P after the FilterChain call. 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to