Tapestry 4 中的过期会话重定向

发布于 2024-07-19 05:40:21 字数 38 浏览 1 评论 0原文

当用户会话过期时,如何更改 Tapestry 4 显示的页面?

How can you change the page displayed by Tapestry 4 when the user's session expires?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

找回味觉 2024-07-26 05:40:21

啊,过去,Tapestry 4...

我认为有不同的方法..

  • 只需将要显示的页面命名为“StaleSession.html”,或者

  • 将某些内容放入您的 app.application 文件中......例如

  • 在 hivemodule.xml 中添加一些内容,例如


<属性名称=“staleSessionPageName”值=“MyStaleSessionPage”/>

第 h

Ah, the old days, Tapestry 4...

I think there were different ways..

  • just name the page you want to display "StaleSession.html", or

  • put something in your app.application file.. like

    <page name="StaleSession" specification-path="tapestry/page/StaleSession.page"/>

or

  • put something in your hivemodule.xml, like

<contribution configuration-id="tapestry.InfrastructureOverrides">
<property name="staleSessionPageName" value="MyStaleSessionPage" />
</contribution>

hth

_蜘蛛 2024-07-26 05:40:21

如果您需要检查用户是否已登录或类似的情况,您可以在 Visit 对象中设置一个属性,并在页面的 validate(IRequestCycle Cycle) 方法中检查它。 如果有多个页面,请为所有要在没有用户登录时重定向的页面创建一个超类,并在超类中实现该方法。 请记住,每当您调用 getVisit() 时,如果没有任何实例,您都会获得一个新实例,因此您需要在 Visit 对象中设置一个属性来查看会话是否有效。

If you need to check if the user is logged in or something similar, you can set a property in your Visit object, and check for it in the validate(IRequestCycle cycle) method of your pages. If there are several pages, create a superclass for all the pages you want to redirect when there's no user logged in, and implement the method in the superclass. Remember that whenever you call getVisit() you get a new instance if there isn't any, so you need to set a property in your Visit object to see if the session is valid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文