You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Chisholm, Paul" <Pa...@AirservicesAustralia.com> on 2003/06/16 13:46:09 UTC
Filters and Forwarding
Hi,
I have a servlet X that forwards to a servlet Y. When Y is requested
directly there is a filter specified in web.xml that does some
preprocessing of the request. When X forwards to Y I want the request to
pass through the filter, but it seems to go straight to Y. Associating
the filter with X wont work because the filter would then process the
request before X, instead of between X and Y. I can incorporate the
functionality of the filter in Y but that defeats the whole purpose of
using filters (there are situations where I want to use Y without the
filter). Is there is way to do what I want?
Thanks,
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Filters and Forwarding
Posted by Tim Funk <fu...@joedog.org>.
Filters apply only to the incoming request. Filters are not invoked on
subsequent forward() or include().
But the 2.4 spec will allow filters to be run on forward() (and I think
include, read the spec to verify)
-Tim
Chisholm, Paul wrote:
> Hi,
>
> I have a servlet X that forwards to a servlet Y. When Y is requested
> directly there is a filter specified in web.xml that does some
> preprocessing of the request. When X forwards to Y I want the request to
> pass through the filter, but it seems to go straight to Y. Associating
> the filter with X wont work because the filter would then process the
> request before X, instead of between X and Y. I can incorporate the
> functionality of the filter in Y but that defeats the whole purpose of
> using filters (there are situations where I want to use Y without the
> filter). Is there is way to do what I want?
>
> Thanks,
> Paul
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Filters and Forwarding
Posted by Antonio Fiol BonnĂn <fi...@terra.es>.
If you are allowing incoming requests to Y, you can make X to
sendRedirect() to Y.
A bit slower, as it needs the client to access Y himself, but depending
on your needs, it may work.
Antonio Fiol
Chisholm, Paul wrote:
>Hi,
>
>I have a servlet X that forwards to a servlet Y. When Y is requested
>directly there is a filter specified in web.xml that does some
>preprocessing of the request. When X forwards to Y I want the request to
>pass through the filter, but it seems to go straight to Y. Associating
>the filter with X wont work because the filter would then process the
>request before X, instead of between X and Y. I can incorporate the
>functionality of the filter in Y but that defeats the whole purpose of
>using filters (there are situations where I want to use Y without the
>filter). Is there is way to do what I want?
>
>Thanks,
>Paul
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>