Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Replacement for PhaseListeners in RAP 2.x
Replacement for PhaseListeners in RAP 2.x [message #1064684] Thu, 20 June 2013 14:12 Go to next message
Thorsten Lichtenwalter is currently offline Thorsten LichtenwalterFriend
Messages: 12
Registered: February 2013
Junior Member
Up to now (RAP 1.x) I used a PhaseListener to be notified of any client action. This was a nice way to implement a session timeout mechanism in my RAP server app. Every time a user loggs in a PhaseListener is started and every client action will trigger an update in my timeout handler. RAP 2.x doesn't provide this feature any more. It's limited to register PhaseListeners at application startup only. Is there any possibility to be notified of any client action within RAP context? Or do I have to broaden the scope and use ServletFilters?



Thorsten Lichtenwalter
Software Development
msgGillardon AG, Bretten, Germany
Re: Replacement for PhaseListeners in RAP 2.x [message #1065069 is a reply to message #1064684] Mon, 24 June 2013 08:34 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Thorsten,

Could you explain why you need to implement the session timeout yourself
and how your timeout differs from the servlet container's session timeout?

Why does a static PhaseListener not work in your case?

Not sure if it's related to your problem, but as of 2.1, browser clients
notify the server when they are closed and the UISession is then terminated.

Best regards,
Ralf

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=284273

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1065274 is a reply to message #1065069] Tue, 25 June 2013 08:23 Go to previous messageGo to next message
Thorsten Lichtenwalter is currently offline Thorsten LichtenwalterFriend
Messages: 12
Registered: February 2013
Junior Member
Hi Ralf,

> Could you explain why you need to implement the session timeout yourself
> and how your timeout differs from the servlet container's session timeout?

I am using a short http timeout and a long application timeout. Advantage: in case of a browser crash it won't allocate resources on the server for too long (because of a short http timeout). But to refresh the application timeout i'll have to be aware of every client action. Using a PhaseListener was a fine solution.

> Why does a static PhaseListener not work in your case?

What do you mean by 'static'? I can still continue using the old way of using a PhaseListener (every time a user loggs in a PhaseListener is started) but the api is deprecated. I want to implement a solid solution.

Are there any alternatives?



Thorsten Lichtenwalter
Software Development
msgGillardon AG, Bretten, Germany

[Updated on: Tue, 25 June 2013 08:24]

Report message to a moderator

Re: Replacement for PhaseListeners in RAP 2.x [message #1065353 is a reply to message #1065274] Tue, 25 June 2013 11:54 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Ok, I think I understand.

You can still use a PhaseListener for that, but instead of one per
UISession, you'd have a single shared PhaseListener for all sessions.
This phase listener must be registered in the ApplicationConfiguration.

Phase listeners are not session-specific, that's why the API for adding
PhaseListeners dynamically is deprecated.

Regards,
Ralf

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1065367 is a reply to message #1065353] Tue, 25 June 2013 13:11 Go to previous messageGo to next message
Thorsten Lichtenwalter is currently offline Thorsten LichtenwalterFriend
Messages: 12
Registered: February 2013
Junior Member
Hi Ralph,

thx. I will have a try at your solution.



Thorsten Lichtenwalter
Software Development
msgGillardon AG, Bretten, Germany
Re: Replacement for PhaseListeners in RAP 2.x [message #1066580 is a reply to message #1065353] Wed, 03 July 2013 09:23 Go to previous messageGo to next message
Thorsten Lichtenwalter is currently offline Thorsten LichtenwalterFriend
Messages: 12
Registered: February 2013
Junior Member
Ralf Sternberg wrote on Tue, 25 June 2013 07:54
Ok, I think I understand.

You can still use a PhaseListener for that, but instead of one per
UISession, you'd have a single shared PhaseListener for all sessions.
This phase listener must be registered in the ApplicationConfiguration.

Phase listeners are not session-specific, that's why the API for adding
PhaseListeners dynamically is deprecated.


In the meantime I gave it a try... and it is the way to go (syncing from a global PhaseListener to a user specific session is no problem at all). Thx for the hint.



Thorsten Lichtenwalter
Software Development
msgGillardon AG, Bretten, Germany
Re: Replacement for PhaseListeners in RAP 2.x [message #1066943 is a reply to message #1066580] Fri, 05 July 2013 08:20 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Thanks for the update! Good to know that this works for you.

Regards,
Ralf

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1386771 is a reply to message #1066943] Fri, 20 June 2014 10:53 Go to previous messageGo to next message
Gábor Lipták is currently offline Gábor LiptákFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,

One question: according to my debug session we use org.eclipse.rap.ui.internal.servlet.WorkbenchApplicationConfiguration. How can I add a PhaseListener to this class? Is it possible in any way? I would like to use your PhaseListener example at https://gist.github.com/ralfstx/5791804, but I do not see the way to do so.

I see, that the WorkbenchApplicationConfiguration adds the PhaseListener instances to the Application. Is there any way to retrieve the Application instance I am currently in?

Regards and thanks,

Gábor Lipták

[Updated on: Fri, 20 June 2014 10:59]

Report message to a moderator

Re: Replacement for PhaseListeners in RAP 2.x [message #1386775 is a reply to message #1386771] Fri, 20 June 2014 11:14 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Gábor,
PhaseListeners have been deprecated in RAP 2.3 and will be completely
removed in RAP 3.0 (API already removed in master). If you want to
render an HTML attribute for particular widget try this code in RAP 2.3+:
---------
Button pushButton = new Button( parent, SWT.PUSH );
JavaScriptExecutor executor = RWT.getClient().getService(
JavaScriptExecutor.class );
if( executor != null ) {
executor.execute( "rap.getObject(\"" + WidgetUtil.getId( pushButton )
+ "\").$el.attr(\"foo\", \"bar\");" );
}
---------
HTH,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1386779 is a reply to message #1386775] Fri, 20 June 2014 11:49 Go to previous messageGo to next message
Gábor Lipták is currently offline Gábor LiptákFriend
Messages: 21
Registered: July 2009
Junior Member
Hi Ivan,

Thanks for the prompt answer. How could I do such thing in case of a widget created by an Eclipse extension? For example menus? The PhaseListener was a perfect candidate, since it was called "regularly", and I could traverse the widgets. Is there anything similar in 2.3+?

Regards,

Gábor
Re: Replacement for PhaseListeners in RAP 2.x [message #1386934 is a reply to message #1386779] Mon, 23 June 2014 07:49 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
in RAP 2.3 the PhaseListeners are still operational. For 3.0+ - we
implemented MessageFilter (similar to ServletFilter), which is still
internal. Once the implementation is considered stable we will make it API.
Best,
Ivan

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1386945 is a reply to message #1386934] Mon, 23 June 2014 08:40 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
PhaseListener was used as workaround for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=389040, is it possible to use MessageFilter instead in 3.0+ ?

[Updated on: Mon, 23 June 2014 08:41]

Report message to a moderator

Re: Replacement for PhaseListeners in RAP 2.x [message #1386953 is a reply to message #1386945] Mon, 23 June 2014 08:52 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Probably yes.

--
Ivan Furnadjiev

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Replacement for PhaseListeners in RAP 2.x [message #1389068 is a reply to message #1386945] Fri, 27 June 2014 09:27 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

On 23.06.2014 10:40, Arnaud MERGEY wrote:
> PhaseListener was used as workaround for bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=389040, is it possible to
> use MessageFilter instead in 3.0+ ?

Absolutely. I've attached a snippet to this bug.

Regards, Ralf

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Has ScrollBar different behaviour in SWT and RWT?
Next Topic:ServerPushSessions
Goto Forum:
  


Current Time: Thu Apr 18 00:11:05 GMT 2024

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

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

Back to the top