You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by kkus <kk...@hotmail.com> on 2007/12/03 18:08:00 UTC
How can I exclude in for filters in Tomcat 5.5.20?
Hi,
For the following setting in web.xml, if I have a request like /*.earth how
can I exclude it from these filters? I don't want to filters to handle
request from /*.earth. Thanks!
<filter-mapping>
<filter-name>rewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
--
View this message in context: http://www.nabble.com/How-can-I-exclude-in-%3Curl-pattern%3E-for-filters-in-Tomcat-5.5.20--tf4937775.html#a14133848
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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: How can I exclude in for filters in Tomcat 5.5.20?
Posted by Bill Barker <wb...@wilshire.com>.
You can't do it from the config alone (the spec doesn't have exclude
mappings). You would need to do it from within your Filter code, e.g.:
public class RewriteFilter implements Filter {
public void init(FilterConfig conf) {
// init logic here
}
public void destroy() {
// release resources here
}
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
throws ServletException, IOException {
if(forMe(req)) {
// business logic here
}
chain.doFilter(req, res);
}
private boolean forMe(ServletRequest req) {
if(req instanceof HttpServletRequest) {
HttpServletRequest hreq = (HttpServletRequest)req;
return ! hreq.getRequestURI().endsWith(".earth");
}
return true;
}
}
"kkus" <kk...@hotmail.com> wrote in message
news:14133848.post@talk.nabble.com...
>
> Hi,
>
> For the following setting in web.xml, if I have a request like /*.earth
> how
> can I exclude it from these filters? I don't want to filters to handle
> request from /*.earth. Thanks!
>
> <filter-mapping>
> <filter-name>rewriteFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-exclude-in-%3Curl-pattern%3E-for-filters-in-Tomcat-5.5.20--tf4937775.html#a14133848
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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: How can I exclude in for filters in Tomcat 5.5.20?
Posted by Martin Gainty <mg...@hotmail.com>.
good question
2 options
implement with resin
http://www.caucho.com/resin-3.0/config/webapp.xtp#filter-mapping
OR
a filter which which parses RegularExpresssions (as with urlrewrite.xml
configuration from tuckey)
http://tuckey.org/urlrewrite/
e.g.
[^.earth]
Anyone else?
M-
----- Original Message -----
From: "kkus" <kk...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Monday, December 03, 2007 12:08 PM
Subject: How can I exclude in <url-pattern> for filters in Tomcat 5.5.20?
>
> Hi,
>
> For the following setting in web.xml, if I have a request like /*.earth
how
> can I exclude it from these filters? I don't want to filters to handle
> request from /*.earth. Thanks!
>
> <filter-mapping>
> <filter-name>rewriteFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> --
> View this message in context:
http://www.nabble.com/How-can-I-exclude-in-%3Curl-pattern%3E-for-filters-in-
Tomcat-5.5.20--tf4937775.html#a14133848
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
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: How can I exclude in for filters in Tomcat 5.5.20?
Posted by Ken Bowen <kb...@als.com>.
Look into using Url Rewrite Filter: http://tuckey.org/urlrewrite/
kkus wrote:
> Hi,
>
> For the following setting in web.xml, if I have a request like /*.earth how
> can I exclude it from these filters? I don't want to filters to handle
> request from /*.earth. Thanks!
>
> <filter-mapping>
> <filter-name>rewriteFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
> <filter-name>sitemesh</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
>
---------------------------------------------------------------------
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