【问题标题】:ocpsoft rewrite one variable twice useocpsoft 重写一个变量两次使用
【发布时间】:2014-02-06 19:02:55
【问题描述】:

我想像这样重写我的网址:

/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.

如何在“何时”中使用一个变量,在“执行”中使用两次?

【问题讨论】:

  • 能否请您发布您尝试呈现的 XHTML 页面?谢谢。此外,如果您可以在 OCPsoft 支持论坛上发布示例应用程序,这将对确定正在发生的事情非常有帮助。 ocpsoft.org/support
  • 问题不在于 XHTML 页面。它是关于重写的 URL 配置。我想用 /admin/ URL 呈现 /admin/admin.xhtml。
  • 是的,我明白这一点,但是 URL 的呈现方式是这里的一个重要因素。我需要知道失败的链接是如何生成的。
  • 当我直接在地址栏中输入 URL 时会发生这种情况。 XHTML 文件中没有特殊命令。我认为它仅在过滤器匹配 /admin 地址时发生。 @林肯
  • 已确认。这是一个错误:github.com/ocpsoft/rewrite/issues/160 我们将尽快修复。

标签: jsf rewrite prettyfaces ocpsoft-rewrite


【解决方案1】:

此错误已记录在 Rewrite 问题跟踪器中,现已得到解决,并将在未来几天内包含在 Rewrite 的 2.0.11.Final 版本中。在此之前,您可以在今晚部署到 Sonatype Snapshots 存储库时使用最新的 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>

【讨论】:

    猜你喜欢
    • 2018-06-27
    • 2014-06-28
    • 2017-10-01
    • 1970-01-01
    • 2016-02-06
    • 2015-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多