UrlRewriteFilter matching multiple rules?
I have a rule which works just fine:
<rule>
<from>^/(about|account|admin|cpanel)(\?.*)?$</from>
<to last="true">/faces/pages/$1/$1.xhtml$2</to>
</rule>
When I add the following rule after the above, I get a javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20
exception when loading a page that matches the first rule.
<rule>
<from>^/([^\?]+?)/([^\?]+?)(\?.*)?开发者_开发问答$</from>
<to last="true">/faces/pages/$1/$2.xhtml$3</to>
</rule>
According to the documentation, once the first rule is matched, no more rules should be processed because I specified last="true"
. Any idea what I might be missing here?
In web.xml, I changed this (which is shown in the UrlRewriteFilter documentation)
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
to this
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
and it started behaving properly. That's weird, but it works.
It seems that the price of not reinventing the wheel is spending 95% of dev time dealing with 3rd pary bugs. (GlassFish being the major offender.)
精彩评论