web.xml - Java Servlet Filters and WebSphere - URL Pattern issues
- by Ed
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.