You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "LOCHART,DOUGLAS E" <do...@cablespeed.com> on 2005/08/31 02:40:32 UTC

HELP PLEASE (Form submission on a dead session)

<<Sorry for the repost but I really need help with this 
one >>

I thought I was doing logout right.  However I found an 
email in the mailing list that had me change my logout 
mechanism.  I used to logout in a listener method like 
this:


     Visit visit = (Visit)getVisit();
     visit.clear();
     try {
         ((IEngineServiceView)getEngine()).restart( cycle 
);
     }catch(Exception e) {
         _logger.warn("Logout Exception: Ignoring ... 
",e);
     }

Then I read a posting that you should not do this in a 
listener and they proposed using the restart service 
directly.  I could not find an example of this so I tried 
the following:

     Visit visit = (Visit)getVisit();
     visit.clear();
         IEngineService pageService = 
cycle.getEngine().getService(Tapestry.RESTART_SERVICE);
         String pageName = 
cycle.getPage().getExtendedId();
         String redirector = pageService.getLink(cycle, 
null, new String[0]).getURL();
         throw new RedirectException(redirector);

Well either way the logout seems to work but my problem 
still persists.  Maybe its a different issue.

Problem:

1)  A user logs out and the system calls either of the two 
logout methods above. At this I assume the session is 
gone.  I do not close the browser but I only have one 
instance running.
The user session is terminated and the system resets back 
to the Home page.

2)  The user hits the back button a few times and hits a 
link.  The system redirects them back
to the home page (fine).  I do this in class I built to 
handle screen flows between roles.  If you request a page 
not in your role or your not logged in you are kicked back 
out.

3)  The user hits the back button to a different place and 
presses a button,  This button is part of a form that has 
many buttons each with its own listener. ( I don't know if 
this is important but I just wanted to note it)  The act 
of pushing the button causes a the Page to try and render 
(rewind).  Since I am redirecting to the Home Page and 
starting a new session is this form submission trying to 
come in on the current session?  For some reason I thought 
the session id would be part of the form submission and it 
would look up to see that the session the form was 
rendered under was invalid and throw some type of 
exception.  Instead my page tries to respond to it the 
request and all the data is null and we get a 
NullPointerException.  Ideally the user should be sent 
back to the Home page.

As I right this I see that part of my problem is that I do 
a good job validating Page Transaitions but I don't know 
how to handle something like a form submission when the 
session is dead and the user hits a back button to get to 
a form.

Assistance:

1) First which logout method of the 2 I wrote is 
appropriate or is there a better one.  All of our logouts 
are done within a listener when user activated or done 
internally.

2) When a user tries to do an action on a page where the 
session should no longer be active
how do I stop this from happening?  Is there a built in 
Tapestry way to handle this?

Please help, I still don't have a strong grasp of 
everything that goes on in Tapestry (but I am learning) 
and this is my first web app so all of this stuff is new 
to me.

Thanks again in advance y'all!

BTW I am using Tapestry 3.0.3 in Tomcat 5.0.28

Doug







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