문제

I want to rewrite my urls like this:

/admin/ -> /admin/admin.xhtml

I wrote this code:

return ConfigurationBuilder.begin()
        .addRule(TrailingSlash.append())
                .when(Path.matches("/{page}"))
                .perform(Forward.to("/{page}/{page}.xhtml"))

but with this configuration I got this exception:

org.ocpsoft.rewrite.exception.ParameterizationException:
Must supply [2] values to build output string.

How can i use one variable from "when", twice in "perform"?

도움이 되었습니까?

해결책

This bug has been documented in the Rewrite issue tracker, has now been resolved, and will be included in the 2.0.11.Final release of Rewrite in the next few days. Until then you can use the latest 2.0.11-SNAPSHOT when it deploys to the Sonatype Snapshots repository tonight, or build from sources if you need it sooner (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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top