You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Florian Hopf <ho...@synyx.de> on 2008/11/06 15:47:51 UTC
Forward filter mapping including path info
Hi,
I am in a situation where I want to map a forward filter based on a
servlet and an additional path. The path that is forwarded to looks
something like this:
/servlet/long/path.to/my.jsp
The path info is mapped by the servlet to a JSP in the file system.
My filter declaration looks like this:
<filter-mapping>
<filter-name>ResourceTypesListFilter</filter-name>
<url-pattern>/servlet/long/path.to/my.jsp</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
This filter works ok if I omit the dispatcher-node and send a redirect
but does not work for forwards. This is what is logged when I enable
debug-logging for ApplicationDispatcher:
DEBUG [ationDispatcher: 185] servletPath=/servlet,
pathInfo=/long/path.to/my.jsp, queryString=null, name=null
DEBUG [ationDispatcher: 371] Path Based Forward
The following mapping does work but is too general:
<filter-mapping>
<filter-name>ResourceTypesListFilter</filter-name>
<url-pattern>/servlet/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Is a mapping containing a path info not supported for forwards?
I tested this on Tomcat apache-tomcat-5.5.26 as well as
apache-tomcat-6.0.13, my webapp is 2.4.
Regards
Flo
---------------------------------------------------------------------
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
Re: Forward filter mapping including path info
Posted by Florian Hopf <ho...@synyx.de>.
Hi Mark,
Mark Thomas schrieb:
> Florian Hopf wrote:
>>
>> Is a mapping containing a path info not supported for forwards?
>
> Looks like https://issues.apache.org/bugzilla/show_bug.cgi?id=45441
>
> This is fixed in 6.0.x trunk if you want to try that or wait for 6.0.19.
>
Thank's a lot, that's it. We will see if we can update when 6.0.19 is out.
Also thanks to Christopher for trying to help.
Regards
Florian
---------------------------------------------------------------------
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
Re: Forward filter mapping including path info
Posted by Mark Thomas <ma...@apache.org>.
Florian Hopf wrote:
> Hi,
>
> I am in a situation where I want to map a forward filter based on a
> servlet and an additional path. The path that is forwarded to looks
> something like this:
>
> /servlet/long/path.to/my.jsp
>
> The path info is mapped by the servlet to a JSP in the file system.
>
> My filter declaration looks like this:
>
> <filter-mapping>
> <filter-name>ResourceTypesListFilter</filter-name>
> <url-pattern>/servlet/long/path.to/my.jsp</url-pattern>
> <dispatcher>FORWARD</dispatcher>
> </filter-mapping>
>
> This filter works ok if I omit the dispatcher-node and send a redirect
> but does not work for forwards. This is what is logged when I enable
> debug-logging for ApplicationDispatcher:
>
> DEBUG [ationDispatcher: 185] servletPath=/servlet,
> pathInfo=/long/path.to/my.jsp, queryString=null, name=null
> DEBUG [ationDispatcher: 371] Path Based Forward
>
> The following mapping does work but is too general:
>
> <filter-mapping>
> <filter-name>ResourceTypesListFilter</filter-name>
> <url-pattern>/servlet/*</url-pattern>
> <dispatcher>FORWARD</dispatcher>
> </filter-mapping>
>
> Is a mapping containing a path info not supported for forwards?
Looks like https://issues.apache.org/bugzilla/show_bug.cgi?id=45441
This is fixed in 6.0.x trunk if you want to try that or wait for 6.0.19.
Mark
---------------------------------------------------------------------
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
Re: Forward filter mapping including path info
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Florian,
Florian Hopf wrote:
> Is a mapping containing a path info not supported for forwards?
So, just to clarify:
* You have a filter you'd like to apply to /servlet/long/path/my.jsp
* You configured the filter to be active on FORWARD dispatches
* Forwarding to /servlet/long/path/my.jsp from another servlet
does not invoke your filter
* Removing the FORWARD rule from the filter setup works when requests
are forwarded, but it will also apply the filter for regular requests
as well, and you don't want that.
How many of these are accurate?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkkZ9z8ACgkQ9CaO5/Lv0PD8qQCgvcyuiMeUgsvdmbzLC8KpC6uJ
nKIAn0dPI9+T2kJnCed/a+bJWpWx6Xqz
=foQC
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
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