cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject Re: best way to show login page when session expires? (Javascript/Java based Cocoon app.)
Date Thu, 19 May 2011 10:20:32 GMT
On Wed, 2011-05-18 at 10:45 -0400, Paul Joseph wrote:
> Hi there,
> I have a Cocoon app that has numerous pages...I use Javascript 
> (flowscript) to do the display and Java to do the "business logic."
> In the Java layer, I have code to detect when the session expires and 
> this works nicely and so I am able to maintain a count of currently 
> logged in users.
> Here is my request:  A customer asked that when their session expires, 
> that they be shown the login page automatically.
> Now I know when the session expires, but how do I show the Login page 
> from within Java code?  They could be anywhere in the app so I presume I 
> should directly have the Java code somehow display the Login page?
> Pointers much appreciated.

I reckon all pages are going through an action which test, whether the
user is logged in, correct? If not how to you test whether the user is
logged in and has the authority to see the page?

The simplest I guess is to write your own action extending e.g. where
you test for the session.

You can use something like the following in your sitemap:
<map:act type="session">
  <!-- session exists go on with generating USER page -->
<!-- session failed show login page-->

Another route is to test it in your existing flow script and redirect 
from within that flow to the login page.

if (YourJavaClass.validateSession(session)){
 // session exists go on with generating USER page
 // session failed show login page

However that depends on your usecase which makes more sense. 

Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message