web.xml - Java Servlet Filters and WebSphere - URL Pattern issues
Posted
by Ed
on Stack Overflow
See other posts from Stack Overflow
or by Ed
Published on 2009-12-10T09:08:21Z
Indexed on
2010/04/27
21:43 UTC
Read the original article
Hit count: 567
Hi,
So we are running a web application that has been tested on Tomcat, Glassfish, WebLogic and WebSphere. All run correctly except WebSphere. The issue is that filters are not processed for files under a certain directory.
For example I have a filter that checks the user's lanuage from browser cookies and another that get the user's username, in the web.xml there are configured like so:
<!-- ****************************** -->
<!-- * Security context filtering * -->
<!-- ****************************** -->
<filter>
<filter-name>SetSecurityContextFilter</filter-name>
<filter-class>
com.test.security.SecurityContextServletFilter
</filter-class>
</filter>
<!-- ****************************** -->
<!-- ** Locale context filtering ** -->
<!-- ****************************** -->
<filter>
<filter-name>SetLocaleFilter</filter-name>
<filter-class>
com.test.locale.LocaleServletFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>SetSecurityContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SetLocaleFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Both filters set a static threadlocal variable which can be accessed from a static getter, but when the same file 'test.jsp' invokes the getters, under 'contextroot/js' they return the default values (as if unset) while under 'contextroot/pages' they are correct.
Any ideas?
Thanks in advance.
© Stack Overflow or respective owner