We are encountering a strange issue with the order in which the filters are getting triggered in our web application.
We are integrating a sitemesh filter in our application and we are seeing issues with the spring security tags in the decorator pages. This is happening because the springSecurityFilterChain is executing after the sitemesh filter.
In our web.xml we have the following:
<filter-mapping> <filter-name>storefrontTenantFilterChain</filter-name> <servlet-name>DispatcherServlet</servlet-name> </filter-mapping> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping>
where storefrontTenantFilterchain is declared as a spring delegatingFilterProxy
<constructor-arg> <list> <ref bean="storefrontSessionFilter" /> <ref bean="springSecurityFilterChain" /> </list> </constructor-arg>
and the sitemesh filter is just a regular javax.servlet.Filter implementation
These filters should be triggering in the order in which they are declared in the web.xml
<filter-name>filter1</filter-name> <url-pattern>/*</url-pattern> <filter-name>filter2</filter-name> <url-pattern>/*</url-pattern>
This is not happening. I am setting some breakpoints to track the order of execution and the sitemesh filter is executing before the fdStorefrontTenantFilterChain (the one that references the springSecurityFilterChain)
Unfortunately declaring the sitemesh filter as bean and adding this to the constructor list of the PlatformFilterChain is not an option due to some custom initialization in the public void init(FilterConfig filterConfig)
Is there something that I'm missing? I've tried many different things and the only thing that worked was using the de.hybris.platform.util.HybrisInitFilter (which is deprecated) and moving the springSecurityFilterChain to the web.xml but this is breaking some other functionality.
Thanks in advance for your response.