I am fairly new to Servlet Filters and have basically joined a project using them and added an additional filter to the web.xml
file (deployed on Tomcat 5.5).
I am 95% sure that at some point it was working correctly but now when debugging if I put breakpoints at the top of the JSP page I am trying to view (login.jsp
), it's template page (page.jsp
) and within both of the configured filter's doFilter()
method; it runs through the whole of the login.jsp
page (top to bottom), then page.jsp
and the starts processing the filters.
I need it to run the filters first, since one of them determines the language the page should be displayed in (checking cookies, db settings and browser settings) which should then apply to the login.jsp
.
Has anyone got any suggestions as to what might be going wrong?
There is a lot of code I could be posting but am not convinced that would be of any use since it's all working just in the wrong order.
Snippets from the web.xml:
<web-app>
...
<filter>
<filter-name>SetSecurityContextFilter</filter-name>
<filter-class>
com.section2.SecurityContextServletFilter
</filter-class>
</filter>
<filter>
<filter-name>SetLocaleFilter</filter-name>
<filter-class>
com.section2.locale.LocaleServletFilter
</filter-class>
</filter>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
<filter>
<filter-name>ActiveUserFilter</filter-name>
<filter-class>com.section2.ActiveUserFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<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>
<filter-mapping>
<filter-name>ActiveUserFilter</filter-name>
<url-pattern>/pages/section2/user/*</url-pattern>
</filter-mapping>
...
</web-app>
Thanks in advance.