Good day all,

I tried to implement a Tapestry 4 application where the pages are surrounded by 
a parent frame containing a menu. All of the application pages load in the 
child frame.

My issue was that I was using the ServiceLink literal:restart to logout in the 
child frame, which works, but I end up only logging out of the child frame and 
the parent frame remains wrapped around the resulting redirect page. This was 
not the desired behavior.

I then tried to get a reference to the WebSession, invalidate the session and 
then push the user to a "signedoff" page which would provide them with a 
mechanism to get back to the login page.

in the page class
public void doLogout() {
 IRequestCycle cycle = getRequestCycle();
 WebSession sess = cycle.getInfrastructure().getRequest().getSession(false);
 sess.invalidate();
 cycle.activate("singedoff");
}

and in the template
<a href="#" jwcid="@DirectLink" listener="listener:doLogout">Log out</a>

this obviously did not work either.

[Success]
Finally I tried using the restart service to deal with the logout as per the 
example listed here:

http://wiki.apache.org/jakarta-tapestry/LogoutLinkTap4

The example involves setting up the Restart Service with a service link, and 
some java code in the page class.

This also did not give the 100% required behaviour and acted much like my first 
example in which only the child frame would log out and the surrounding frames 
would remain unchanged.

I managed to get a work around that suites me and I hope it will help someone 
else.

I introduced a java script to my login page which deals with the frames. It 
takes care of breaking the frames for the purpose of displaying the login page. 
Once I have called the restart service, the session is invalidated and JAAS 
intercepts the redirect to Home, passing the browser off to the login page, 
which has the required script to break the frames and display the login page as 
a single page.

// Makes sure the Log in Screen is not called from within a frame
function frameBreaker() {
  var isFrame;

  if (window.self.location != window.top.location) {
    // This page is a frame
    isFrame = true;
  }
  else {
    // This is not a frame
    isFrame = false;
  }

  if (isFrame == true) {
    // We are in a frame, break out of the frame and load the login page
window.top.location="login.html";
  }
}
-->

This is only a workaround and I would be keen to hear of any other solutions 
that have worked for you.

Kind regards
Scott.



This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to