tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Gibson" <Steve.Gib...@cowww.com>
Subject RE: [Jakarta Tapestry Wiki] Updated: FrequentlyAskedQuestions/LogoutLink
Date Thu, 14 Oct 2004 18:54:23 GMT
Howard et al, perhaps a suggestion on how this would be done in 3.1
could be added.

Intercepting for the sake of it may not be a good idea.
Perhaps being able to register an EventListener would be nice, though I
would have thought that there would be a SessionCleanupListener like the
ThreadCleanupListener...

Haven't had time to fire up Tapestry 3.1 yet, so don't have all the
pieces yet.

Thanks,

Steve Gibson

-----Original Message-----
From: tapestry-dev@jakarta.apache.org
[mailto:tapestry-dev@jakarta.apache.org] 
Sent: Thursday, October 14, 2004 2:49 PM
To: tapestry-dev@jakarta.apache.org
Subject: [Jakarta Tapestry Wiki] Updated:
FrequentlyAskedQuestions/LogoutLink


   Date: 2004-10-14T11:49:21
   Editor: SteveGibson <steve.gibson@cowww.com>
   Wiki: Jakarta Tapestry Wiki
   Page: FrequentlyAskedQuestions/LogoutLink
   URL:
http://wiki.apache.org/jakarta-tapestry/FrequentlyAskedQuestions/LogoutL
ink

   Corrected Enhanced Page version + Enhanced Engine version and v3.1
Notes  

Change Log:

------------------------------------------------------------------------
------
@@ -3,6 +3,9 @@
 [http://article.gmane.org/gmane.comp.java.tapestry.user/8108]
 I have simplified it, though the functionality will be identical under
3.0.
 
+''' Note: This is pretty much meaningless under HiveMind 3.1.
+From what I can see, you would probably need to use Approach 1 or
approach 1 and either use an interceptor on the RestartService, or
extend the RestartService.  This shows why I try not to extend the
"inner workings" of Tapestry or any 3rd party API - they change,
sometimes inexplicably. Why AbstractEngine had the restart method is a
historical question best left to those who know... ;-) '''
+
 = Simple Answer =
 Use a ServiceLink to the RestartService in your page(.html).
 {{{
@@ -27,11 +30,11 @@
 {{{
 public void logout(IRequestCycle cycle)
 {
-    IEngine engine = getEngine();
+    IEngineServiceView engine = (IEngineServiceView)getEngine();
     engine.restart();
 }
 }}}
-
+ ''Thanks to Markus Wiederkehr for pointing out that IEngineServiceView
(not IEngine) has the restart method ''
 
 If you look at the source for AbstractEngine, you will see that it
invalidates the HttpSession and redirects the user to the default URL of
the servlet. I personally would put any extra logic required here as it
keeps it all in one place.
 
@@ -40,3 +43,16 @@
    <span jwcid="@ActionLink"
listener="ognl:listeners.logout">Logout</span>
 }}}
 
+
+= Engine Enhancement Approach =
+If you absolutely, positively want to enhance BaseEngine, rather than
to hide this code in your BasePage enhancement...
+
+{{{
+    public void restart(IRequestCycle cycle) throws IOException
+    {
+        // ... Do cleanup work here / defer to a method / fire an event

+        // This needs to complete before super.restart(IRequestCycle) 
+        // otherwise the rug may be pulled out from under you
+        super.restart(cycle);
+    }
+}}}

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


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


Mime
View raw message