我正在阅读Filter概念,并怀疑是否会在JSF应用程序中为AJAX请求调用过滤器。
过滤器映射如下
<filter-mapping>
<filter-name>ModuleSecurityFilter</filter-name>
<url-pattern>/protected/*</url-pattern>
</filter-mapping>
答案 0 :(得分:2)
是的。只要从您的JSF视图提交到与过滤器的url-pattern
匹配的URL,就会调用过滤器。在您的情况下,如果提交是针对任何“/protected/anything
”
使用JSF1.2,您的所有命令操作(commandbutton / commandlinks)将被强制POST将表单数据提交到同一视图。
假设您当前的观看次数为/protected/firstview.jsf
,那么您的所有<h:commandButton /> , <h:commandLink />, <a4j:commandButton /> <a4j:commandLink /> , <a4j:support action="" />
都会向相同的观看次序/protected/firstview.jsf
提交POST请求。因此,所有请求都必须通过过滤器。