Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Detecting page reload of the browser(Avoid re-login when the user hits F5)
icon3.gif  Detecting page reload of the browser [message #502944] Thu, 10 December 2009 11:59 Go to next message
Sascha Becher is currently offline Sascha BecherFriend
Messages: 17
Registered: December 2009
Junior Member
I have implemented a login dialog that opens prior to the perspective in openWindows():

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
	@Override
	public boolean openWindows() {
		LoginDialog loginDialog = new LoginDialog();
		loginDialog.open();
	}
}

// login is done via JAAS and JBoss org.jboss.security.client.SecurityClient

SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
securityClient.setSimple(userName, password);
securityClient.login();



This works fine. When the user hits F5 in his browser, the Perspective is being rebuild. So the WorkbenchAdvisor calls again openWindows(), and the LoginDialog re-appears. I have no session information at this moment, so I can't decide, to skip the login dialog.

How can I detect a browser reload?

Edit:
Does a web page reload on a RAP application always destroys the session as outlined here? http://www.eclipse.org/forums/index.php?t=tree&th=42428
The RAP online demos treat F5 as a simple GUI redraw, which is a fine feature as long as there is no session information incorporated.

Edit:
I added a SessionStoreListener. The beforeDestroy() is being called just after the page reload. Curiously the session id stays the same with several page reloads. Can I re-register the HttpSession object somehow?

		RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener() {

			@Override
			public void beforeDestroy(SessionStoreEvent event) {

				HttpSession session = event.getSessionStore().getHttpSession();
				System.out.println("SESSION  destroyed, session id = " + session.getId()); //$NON-NLS-1$
			}

		});

[Updated on: Thu, 10 December 2009 13:03]

Report message to a moderator

Re: Detecting page reload of the browser [message #502964 is a reply to message #502944] Thu, 10 December 2009 13:04 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
please see the news post below, where a similar problem was discussed:
http://www.eclipse.org/forums/index.php?t=tree&th=42428& amp;S=54c759614ea560ca5e3c27e679e5c81e

HTH
Rüdiger Herrmann
http://eclipsesource.com

Sascha wrote:
> I have implemented a login dialog that opens prior to the perspective in
> openWindows():
>
>
> public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
> @Override
> public boolean openWindows() {
> LoginDialog loginDialog = new LoginDialog();
> loginDialog.open();
> }
> }
>
> // login is done via JAAS and JBoss
> org.jboss.security.client.SecurityClient
>
> SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
> securityClient.setSimple(userName, password);
> securityClient.login();
>
>
>
> This works fine. When the user hits F5 in his browser, the Perspective
> is being rebuild. So the WorkbenchAdvisor calls again openWindows(), and
> the LoginDialog re-appears. I have no session information at this
> moment, so I can't decide, to skip the login dialog.
>
> How can I detect a browser reload?
Previous Topic:How to create a comlex list
Next Topic:Strategy for Constants ?
Goto Forum:
  


Current Time: Thu Apr 25 14:38:17 GMT 2024

Powered by FUDForum. Page generated in 0.02753 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top