Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Browser refresh issue
Browser refresh issue [message #748218] Mon, 24 October 2011 15:08 Go to next message
DANIEL  is currently offline DANIEL Friend
Messages: 13
Registered: November 2010
Junior Member
We are trying to get control when the user refresh the browser and not when the session is about to be destroyed but could not find away to accomplish that. Here's what we are doing:

Our initial dialog is a login dialog, where the user types his credentials and then we open a private socket to our server which we communicate with. Don't get confused as this is a non-web server and it has nothing to do with RAP. We want the user to remain connected to our server and not to display the login dialog when the user refresh the browser.

The first step was to keep all session singleton instances in the http session instead of the RAP context session store, in order to keep the data available after refresh was pressed. In brief we changed the RAP code "SessionSingletonBase.getInstance(clazz)" to "RWT.getSessionStore().getHttpSession().setAttribute(clazz.getName(), object)". This change worked successfully and all of our session singleton objects are now available/kept after the refresh.

In addition we set up a listener using org.eclipse.rwt.service.SessionStoreListener and get control in the method "beforeDestroy". We would like to close our private socket that we opened with our private server during login, when the session is destroyed. But unfortunately, the beforeDestroy method gives control also when a refresh was pressed and we don't want to close our socket in this case.

Any idea how we can get control when the session is destroyed and not when a refresh was pressed? Again, we want to close our private socket only during a real destroy.
Re: Browser refresh issue [message #749448 is a reply to message #748218] Tue, 25 October 2011 08:17 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Daniel,

I don't fully understand your case but couldn't you register an
HttpSessionListener? The HttpSession remains untouched on browser
refresh, so you'd receive a sessionDestroyed only when the servlet
container times out the session. Note that this event occurs *before*
RAP cleans up the session, so you must not do anything that would
interfere with this cleanup.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Browser refresh issue [message #753573 is a reply to message #749448] Thu, 27 October 2011 20:07 Go to previous messageGo to next message
DANIEL Missing name is currently offline DANIEL Missing nameFriend
Messages: 12
Registered: July 2011
Location: TORONTO
Junior Member
That is what I initially tried but it did not work. Here is step by step what I did -

I added the following lines to my web.xml in the war file.

<listener>
   <listener-class>my.package.name.UIHttpSessionListener</listener-class>
</listener>


And created the class in one of the plug-ins (not fragment).

public class UIHttpSessionListener implements HttpSessionListener 
{....


When I start Tomcat I get the error message below.

27-Oct-2011 3:56:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
27-Oct-2011 3:56:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/myappl] startup failed due to previous errors
Re: Browser refresh issue [message #753574 is a reply to message #749448] Thu, 27 October 2011 20:07 Go to previous messageGo to next message
DANIEL  is currently offline DANIEL Friend
Messages: 13
Registered: November 2010
Junior Member
That is what I initially tried but it did not work. Here is step by step what I did -

I added the following lines to my web.xml in the war file.

<listener>
<listener-class>my.package.name.UIHttpSessionListener</listener-class>
</listener>

And created the class in one of the plug-ins (not fragment).

public class UIHttpSessionListener implements HttpSessionListener
{....

When I start Tomcat I get the error message below.

27-Oct-2011 3:56:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
27-Oct-2011 3:56:18 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/myappl] startup failed due to previous errors
Re: Browser refresh issue [message #753575 is a reply to message #753573] Thu, 27 October 2011 20:12 Go to previous messageGo to next message
DANIEL Missing name is currently offline DANIEL Missing nameFriend
Messages: 12
Registered: July 2011
Location: TORONTO
Junior Member
Here is the full error message. I guess my http listener class was not found. Any idea why?

SEVERE: Error configuring application listener of class my.package.UIHttpSessionListener
java.lang.ClassNotFoundException: my.package.UIHttpSessionListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4115)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4671)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Re: Browser refresh issue [message #753577 is a reply to message #753574] Thu, 27 October 2011 20:12 Go to previous messageGo to next message
DANIEL  is currently offline DANIEL Friend
Messages: 13
Registered: November 2010
Junior Member
Here is the full error message. I guess my http listener class was not found. Any idea why?

SEVERE: Error configuring application listener of class my.package.UIHttpSessionListener
java.lang.ClassNotFoundException: my.package.UIHttpSessionListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1493)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4115)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4671)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Re: Browser refresh issue [message #755202 is a reply to message #753577] Mon, 07 November 2011 16:31 Go to previous message
DANIEL Missing name is currently offline DANIEL Missing nameFriend
Messages: 12
Registered: July 2011
Location: TORONTO
Junior Member
Anyone can help?
Re: Browser refresh issue [message #755207 is a reply to message #753577] Mon, 07 November 2011 16:31 Go to previous message
DANIEL  is currently offline DANIEL Friend
Messages: 13
Registered: November 2010
Junior Member
Anyone can help?
Previous Topic:Browser refresh issue
Next Topic:how to make two OSGi bundles and connect then?
Goto Forum:
  


Current Time: Fri Apr 26 17:58:06 GMT 2024

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

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

Back to the top