tags:

views:

248

answers:

2

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

A: 

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.

Chochos
Yes. That checks for logged in. But tapestry has its own 'Your session is expired, please try restarting the session' page that is relatively ugly and I just want to bounce users to my login page.
James Massey
+3  A: 

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

lutzh