【问题标题】:Redirect from old URL to new URL in Apache Tapestry在 Apache Tapestry 中从旧 URL 重定向到新 URL
【发布时间】:2019-02-28 02:43:00
【问题描述】:

我是 Tapestry 的新手,如果这非常容易实现,或者如果我对他的东西组合在一起有误,我深表歉意。

我试图从旧 URL 重定向到挂毯中的新 URL。

OldClass.page

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
  "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
  "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
<page-specification class="OldClass">

  <property name="permission" initial-value="XXX" />

</page-specification>

OldClass.java

// imports...

public abstract class OldClass extends PageBaseClass implements PageBeginRenderListener {

    public void pageBeginRender(PageEvent event) {
        // redirect code...
        throw new PageRedirectException(...);
    } 
}

但我收到一条错误消息 Could not find the template page for OldClass

【问题讨论】:

    标签: tapestry


    【解决方案1】:

    我说的没错,它是 Tapestry 4 应用程序吗?我相信页面渲染阶段对于重定向来说太晚了。

    作为文档suggest,您需要使用PageValidateListener 事件:

    当一个页面被激活(选择呈现响应)时。抛出 PageRedirectException 以激活不同的页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-19
      • 2017-02-27
      • 2014-04-10
      • 1970-01-01
      相关资源
      最近更新 更多