Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to send JS Code from one session to another through JSWriter?
icon5.gif  How to send JS Code from one session to another through JSWriter? [message #518160] Wed, 03 March 2010 10:23 Go to next message
Eduard  is currently offline Eduard Friend
Messages: 29
Registered: September 2009
Junior Member
Hello RAP-Community!

I've written a custom widget. It is based on a composite.

I opened two sessions form two diffrent Browsers. Session A and Session B.

Each session has its own custom widget. When I try to send JSCode out of Sesssion A through the JSWriter from the custom widget which is deployed in Session B, the JSCode is always send to session A and not to B.

I checked the JSWriter instance when it is called. Its the correct JSWriter from session B. But the code is still send to session A.

Am I doing something wrong or is that usecase not possible in RAP?

Best regards
Eduard

PS: Here is a code part from the custom widget:
public class FlashWidget extends Composite {
...
	public final JSWriter writer;
	
	public FlashWidget(Composite parent, SessionDeviceManager sessionDM) {
		...
		writer = JSWriter.getWriterFor( this );
	}

	public void sendServerInputToClient(DeviceType deviceType, String deviceName, Input input){

		try {
			writer.call("forwardServerInputToClient", new Object[]{deviceType.name() + ":::" + deviceName + ":::" + input.name()});

		} catch (IOException e) {}
		
	}
}
Re: How to send JS Code from one session to another through JSWriter? [message #519335 is a reply to message #518160] Mon, 08 March 2010 14:34 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Eduard,

RAP widgets use a stateless LifeCycleAdapter to communicate with the
client. You should not use the JSWriter in your widget code, but only in
your widget's LCA. Please see the custom widget tutorial for an example.
This tutorial is part of the RAP Developer Guide (in Eclipse with RAP
Tooling installed, click Help -> Help Contents, or see it online at [1]).

To answer your question, it's absolutely correct, the JSWriter sends out
JS code only to the current session. The LCA methods are called for
every request, so every session's widgets will get its updates.

Best regards, Ralf

[1]
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .rap.help/help/html/advanced/custom-widget.html

Eduard wrote:
> Hello RAP-Community!
>
> I've written a custom widget. It is based on a composite.
>
> I opened two sessions form two diffrent Browsers. Session A and Session B.
>
> Each session has its own custom widget. When I try to send JSCode out of
> Sesssion A through the JSWriter from the custom widget which is deployed
> in Session B, the JSCode is always send to session A and not to B.
> I checked the JSWriter instance when it is called. Its the correct
> JSWriter from session B. But the code is still send to session A.
>
> Am I doing something wrong or is that usecase not possible in RAP?
>
> Best regards
> Eduard
>
> PS: Here is a code part from the custom widget:
> public class FlashWidget extends Composite {
> ..
> public final JSWriter writer;
>
> public FlashWidget(Composite parent, SessionDeviceManager sessionDM) {
> ...
> writer = JSWriter.getWriterFor( this );
> }
>
> public void sendServerInputToClient(DeviceType deviceType, String
> deviceName, Input input){
>
> try {
> writer.call("forwardServerInputToClient", new
> Object[]{deviceType.name() + ":::" + deviceName + ":::" + input.name()});
>
> } catch (IOException e) {}
>
> }
> }
Previous Topic:How to programatically close current tab?
Next Topic:[Browser] BrowserFunction does not work anymore
Goto Forum:
  


Current Time: Sun Oct 13 08:48:14 GMT 2024

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

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

Back to the top