[Seaside] Session Problem
Sebastián Perez Escribano
sebaspe at gmail.com
Thu Dec 4 16:57:55 UTC 2008
Hi list, I have a problem with the login session in my site. I'm using
Seaside and Shore Components. The main component of the site has two
divs, a menu to the left, and the main page to the right. On the menu I
use anchors that on click show different components in the main page
(via AJAX). The thing is that when the session expires, I need to go
back to the login page. I've overridden the method #incomingRequest: to
check if the session is active and redirect it to the login page if
needed to. Here's the code to do that:
MySession >> incomingRequest: aRequest
ifTrue: [super incomingRequest: aRequest]
ifFalse: [self logOut: aRequest]]
MySession >> logOut: aRequest
| wttHome |
wttHome := self parent baseUrl asString.
^WAResponse redirectTo: wttHome
This works with the components in the main page, for example: in the
main div I have a component with a button. If I click on the button and
the session isn't active, the session redirects to the log in component,
cleaning all the page. _But when I click on the anchors in the left div
(the menu) and the session isn't active, the log-in component is
placed on the right div (the main component) and does not refresh all
the page (the menu still shows). So in this case I end up with a menu on
the left with anchors and the log-in component in the rigth, and i don't
want the menu component showing in this case.
This is the method that is called when I click on an anchor in the left
WAMyLeftMenu >> updaterOn: html for: component
"This is the method with problems"
callback: [:renderer | self showMainComponent: component on: renderer]
If the session isn´t active, the callback is never called.
Anyone has any experience dealing with expired (via time-out or by code)
sessions and how to reacting to it (redirecting, logging out, etc)?
Any help on this will be appreciated.
More information about the seaside