我想像这样重写我的网址:
/admin/
->/admin/admin.xhtml
我写了这段代码:
return ConfigurationBuilder.begin()
.addRule(TrailingSlash.append())
.when(Path.matches("/{page}"))
.perform(Forward.to("/{page}/{page}.xhtml"))
但是使用此配置,我得到了以下异常:
org.ocpsoft.rewrite.exception.ParameterizationException:
Must supply [2] values to build output string.
如何在"何时"中使用一个变量,在"执行"中使用两次?
此错误已记录在重写问题跟踪器中,现已解决,并将在未来几天内包含在重写的 2.0.11.最终版本中。在此之前,您可以在今晚部署到 Sonatype 快照存储库时使用最新的 2.0.11-SNAPSHOT,或者如果您更早需要它(https://github.com/ocpsoft/rewrite),可以从源代码构建:
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>2.0.11-SNAPSHOT</version>
</dependency>
<!-- To use snapshots, you must also use the Sonatype Snapshots respository -->
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>