for some unknown reason I'm not being able to use filter on struts2. I'm using apache tomcat and using filter to restrict user access ( I preffer rather than Interceptors). Is there any reason why my requests with /tela-paciente is not being filtering??
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>Paciente</filter-name>
<filter-class>br.ufg.inf.sas.filtros.FiltroPaciente</filter-class>
</filter>
<filter-mapping>
<filter-name>Paciente</filter-name>
<url-pattern>/tela-paciente</url-pattern>
</filter-mapping>
Another thing to keep in mind is that in your example the mapping for /tela-paciente occurs after the mapping for /* (for the Struts2 filter), so all requests will be mapped to Struts2 and none will go to your security filter.
Remember that the order of your filters matters. :)
@totaam: The StrutsPrepareAndExecuteFilter does not chain on to other filters unless:
struts.action.excludePattern propertyTherefore, assuming his request does map to an action, his security filter will not be invoked if it is mapped after the Struts2 filter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With