You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mykola Paliyenko <mp...@gmail.com> on 2007/10/03 17:17:00 UTC

Filters do not apply after redirect to the url that serving by Servlet

Hi all,
Do not know if this a problem with Tomcat or with Servlet 2.4 spec
I have a FilterA that redirects from /news to the /mvc/news.html
Then I have a DispatcherServelt that mapped to the /mvc/*
And a FilterB that mapped to *.html for both REQUEST and REDIRECT methods
like this
    <filter-mapping>
        <filter-name>filterB</filter-name>
        <url-pattern>*.html</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
FilterB does not apply during processing

After adding
    <filter-mapping>
        <filter-name>filterB</filter-name>
        <url-pattern>/mvc</url-pattern>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
It works like intended. I understand that Mapping for URL does not apply
when I forward on URL that matching some servlet, very strange but this
workaround proves it

I'm using Tomcat 5.5.9 under java 5

Please suggest whether it is a bug or a standard behavior, as for me it is a
bug

Thanks in advance
Mykola

Re: Filters do not apply after redirect to the url that serving by Servlet

Posted by Mykola Paliyenko <mp...@gmail.com>.
David it is not about /mvc or /mvc/* it is about *.html filter does not
apply on /mvc/news.html
please read carefully the whole problem.

On 10/3/07, David Delbecq <de...@oma.be> wrote:
>
> Better use /mvc/* as url pattern than /mvc if you want it to apply to
> /mvc/news.html
> Mykola Paliyenko a écrit :
> > Hi all,
> > Do not know if this a problem with Tomcat or with Servlet 2.4 spec
> > I have a FilterA that redirects from /news to the /mvc/news.html
> > Then I have a DispatcherServelt that mapped to the /mvc/*
> > And a FilterB that mapped to *.html for both REQUEST and REDIRECT
> methods
> > like this
> >     <filter-mapping>
> >         <filter-name>filterB</filter-name>
> >         <url-pattern>*.html</url-pattern>
> >         <dispatcher>REQUEST</dispatcher>
> >         <dispatcher>FORWARD</dispatcher>
> >     </filter-mapping>
> > FilterB does not apply during processing
> >
> > After adding
> >     <filter-mapping>
> >         <filter-name>filterB</filter-name>
> >         <url-pattern>/mvc</url-pattern>
> >         <dispatcher>FORWARD</dispatcher>
> >     </filter-mapping>
> > It works like intended. I understand that Mapping for URL does not apply
> > when I forward on URL that matching some servlet, very strange but this
> > workaround proves it
> >
> > I'm using Tomcat 5.5.9 under java 5
> >
> > Please suggest whether it is a bug or a standard behavior, as for me it
> is a
> > bug
> >
> > Thanks in advance
> > Mykola
> >
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
WBR, Mykola

Re: Filters do not apply after redirect to the url that serving by Servlet

Posted by David Delbecq <de...@oma.be>.
Better use /mvc/* as url pattern than /mvc if you want it to apply to 
/mvc/news.html
Mykola Paliyenko a écrit :
> Hi all,
> Do not know if this a problem with Tomcat or with Servlet 2.4 spec
> I have a FilterA that redirects from /news to the /mvc/news.html
> Then I have a DispatcherServelt that mapped to the /mvc/*
> And a FilterB that mapped to *.html for both REQUEST and REDIRECT methods
> like this
>     <filter-mapping>
>         <filter-name>filterB</filter-name>
>         <url-pattern>*.html</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
> FilterB does not apply during processing
>
> After adding
>     <filter-mapping>
>         <filter-name>filterB</filter-name>
>         <url-pattern>/mvc</url-pattern>
>         <dispatcher>FORWARD</dispatcher>
>     </filter-mapping>
> It works like intended. I understand that Mapping for URL does not apply
> when I forward on URL that matching some servlet, very strange but this
> workaround proves it
>
> I'm using Tomcat 5.5.9 under java 5
>
> Please suggest whether it is a bug or a standard behavior, as for me it is a
> bug
>
> Thanks in advance
> Mykola
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org