You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tony Giaccone <tg...@gmail.com> on 2009/07/10 20:15:35 UTC

Stale sessions and recovering from same in T4.1.6

Hi,I'm looking for a little guidance on how to solve the following problem.


*First the description:*

The first thing to note, is that our apps all live behind SiteMinder, so
that when a users arrives at our application they have already been through
the credential validation process and the remote_users request header has
their valid userId.

I have two related Applications. AppI and AppM.  Each App allows a group of
users to CRUD a set of Documents.

The users enter the app, and are presented with a Queue of Documents
presented as a table.  The first column of that table for the AppM workers
is an identifier for the document wrapped in a DirectLink.  When they click
on that identifier (anchor), they go to a second page, where they can view
or edit the selected document.


The second App, AppI does a similar presentation for a different set of
Documents,  AppI type documents. Click on the direct link and the AppI
document is presented to be edited or viewed.

Each of these Applications resides in a separate JBOSS container.

The latest requirement is that AppI users need a way to view certain AppM
documents.  There is a read only view of the document in AppM, so the
feeling was that the quickest way to give the AppI users a view into AppM
documents was to link from AppI to AppM's read only view.

AppM links look like:

https://appm.ourDomain.com/appM/Home,mNumberLink.sdirect?sp=S1737

In the AppI Queue I coded up a Generic Link that looks just like the links
created in AppM.

https://appm.ourDomain.com/appM/Home,mNumberLink.sdirect?sp=S1737


*The problem*:

The first time the users clicks the link they are sent to a
StaleSessionException page.  At that point, they are given the choice to
click the refresh session page, and then all is good. Subsequent clicks on
other links, or the same link always work.

I tried to solve the problem with the initial link  by creating my own
StaleSession page, and in the pagevalidate method find the userId, create a
valid user and then throw a page redirect to the same page they were
originally going to, but that, has not work.

What I need is some idea of how to catch that stale session and restart a
fresh new session. I want the first click through to work like all the other
click throughs.

Tony Giaccone

Re: Stale sessions and recovering from same in T4.1.6

Posted by Andreas Andreou <an...@di.uoa.gr>.
Hi... a few options here:
1) https://appm.ourDomain.com/appM/Home,mNumberLink.sdirect?sp=S1737 urls
are direct link urls that have been generated with the stateful flag
set to true.
See http://tapestry.apache.org/tapestry4.1/components/link/directlink.html
for details
but this just means that :
"If true (the default), then the component requires an active (i.e.,
non-new) HttpSession when triggered.
Failing that, it throws a  StaleLinkException  . If false, then no
check is necessary. The latter works
well with links that encode all necessary state inside the URL itself. "

So, you might want to set it to false so that there's no problem
triggering the component...
in that case your pageBeginRender method will get executed afterwards
and you can redirect the user
if he's not logged in, e.t.c.

2) A better approach is to not use direct links, since they include a
lot of internal component structure
in them which if changed (or renamed) will no longer work...
Alternatives are ExternalLinks
http://tapestry.apache.org/tapestry4.1/components/link/externallink.html
(in which case
you have an ExternalPage subclass which shows an AppM document - url
would then be like
https://appm.ourDomain.com/appM/ShowDocument.html?id=1737)
and another alternative is to create and register an IEngineService
subclass that checks user credentials
and then redirects to login or show document page (or just outputs the
document itself if possible)
In both these cases, you can add your own ServiceEncoder for nicere urls

On Fri, Jul 10, 2009 at 9:15 PM, Tony Giaccone<tg...@gmail.com> wrote:
> Hi,I'm looking for a little guidance on how to solve the following problem.
>
>
> *First the description:*
>
> The first thing to note, is that our apps all live behind SiteMinder, so
> that when a users arrives at our application they have already been through
> the credential validation process and the remote_users request header has
> their valid userId.
>
> I have two related Applications. AppI and AppM.  Each App allows a group of
> users to CRUD a set of Documents.
>
> The users enter the app, and are presented with a Queue of Documents
> presented as a table.  The first column of that table for the AppM workers
> is an identifier for the document wrapped in a DirectLink.  When they click
> on that identifier (anchor), they go to a second page, where they can view
> or edit the selected document.
>
>
> The second App, AppI does a similar presentation for a different set of
> Documents,  AppI type documents. Click on the direct link and the AppI
> document is presented to be edited or viewed.
>
> Each of these Applications resides in a separate JBOSS container.
>
> The latest requirement is that AppI users need a way to view certain AppM
> documents.  There is a read only view of the document in AppM, so the
> feeling was that the quickest way to give the AppI users a view into AppM
> documents was to link from AppI to AppM's read only view.
>
> AppM links look like:
>
> https://appm.ourDomain.com/appM/Home,mNumberLink.sdirect?sp=S1737
>
> In the AppI Queue I coded up a Generic Link that looks just like the links
> created in AppM.
>
> https://appm.ourDomain.com/appM/Home,mNumberLink.sdirect?sp=S1737
>
>
> *The problem*:
>
> The first time the users clicks the link they are sent to a
> StaleSessionException page.  At that point, they are given the choice to
> click the refresh session page, and then all is good. Subsequent clicks on
> other links, or the same link always work.
>
> I tried to solve the problem with the initial link  by creating my own
> StaleSession page, and in the pagevalidate method find the userId, create a
> valid user and then throw a page redirect to the same page they were
> originally going to, but that, has not work.
>
> What I need is some idea of how to catch that stale session and restart a
> fresh new session. I want the first click through to work like all the other
> click throughs.
>
> Tony Giaccone
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org