On 19/05/11 13:38, Paul Joseph wrote:
HI Thorsten,

Thank you much for your two suggestions. I will proceed with your second course as it is very easy to do that given the way the app is written.

Just like to add that the Auth approach basically works in the same way. An action is available that will test whether or not a session is expired. Everything is already written, and there is not much that you need to do yourself (besides modifying the sitemap).


best.
Paul

On 5/19/2011 6:20 AM, Thorsten Scherler wrote:
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.
http://cocoon.apache.org/2.1/userdocs/optional/session-action.html 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 -->
</map:act>
<!-- 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
}else{
  // session failed show login page
}

However that depends on your usecase which makes more sense.

salu2

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org



--
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juf...@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StrucBioCat                  | WWW: www.strucbiocat.oulu.fi
Triacle Biocomputing         | WWW: www.triacle-bc.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to