[英]tuckey urlrewrite not working for query variable in url-rewrite
I am using tuckey urlrewrite filter for clean url in JSF on Glassfish. 我在Glassfish的JSF中将tuckey urlrewrite过滤器用于干净的url。 Following is the rule of the filter (which is not working):
以下是过滤器的规则(不起作用):
<rule>
<from>^/user/(.*)$</from>
<to>%{context-path}/faces/testUser.xhtml?username=$1</to>
</rule>
I am getting HTTP-404, The requested resource () is not available. 我正在获取HTTP-404,请求的资源()不可用。
The filter works when I give "to" tag as follows (ie type=redirect): 当我给“ to”标签如下时(即type = redirect),过滤器将起作用:
<to type="redirect">%{context-path}/faces/testUser.xhtml?username=$1</to>
another rule is working just fine for forward: 另一个规则对于转发是很好的:
<rule>
<from>/home</from>
<to>faces/index.xhtml</to>
</rule>
following is the filter configuration in web.xml 以下是web.xml中的过滤器配置
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
any idea, how to work it out? 任何想法,如何解决?
when I changed rule as follows, it is working fine: 当我如下更改规则时,它工作正常:
<rule>
<from>^/user/(.*)$</from>
<to>/faces/testUser.xhtml?username=$1</to>
</rule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.