|
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 |
|
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) {}
>
> }
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03959 seconds