Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Send a request from a custom widget(How to send a request from JS in a custom widget)
Send a request from a custom widget [message #550631] Tue, 03 August 2010 23:33 Go to next message
Jesus   Luna Quiroga is currently offline Jesus Luna QuirogaFriend
Messages: 67
Registered: July 2009
Location: Mexico
Member

Hi,
I wrote a custom widget and it is sending the changes from the server to the client (browser), but the changes from the client (browser) to the server are not sending.

I based my custom widget in the gmap example, I run the example and noticed that has the same behavior. In the debug I realized the changes are propagated until another control sends the request.

In the JavaScript of the gmap example that sends the value I noticed it only adds the parameter to the request, but it doesn't send the request.

if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
var wm = org.eclipse.swt.WidgetManager.getInstance();
var gmapId = wm.findIdByWidget( this );
var center = this._map.getCenter().toString();
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( gmapId + ".centerLocation", center );
}

So, I found a method in the request object: org.eclipse.swt.Request.getInstance().send(), that sends the request, I added it and it worked.

I have a doubt, is this the right mechanism for sending the request?
And if it is, is just enough the call to the method? or do I need to flush the global queue events or something else?

[Updated on: Tue, 03 August 2010 23:36]

Report message to a moderator

Re: Send a request from a custom widget [message #550710 is a reply to message #550631] Wed, 04 August 2010 08:00 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

you are right, the usual pattern is:

var req = org.eclipse.swt.Request.getInstance();
req.addParameter( ... );
req.send();

There should be no need for any extra flushes. The idea is that
parameters can be added to the next request immediately whenever client
state changes, but that the request is sent not before there's a need to
inform the server. As an example, a checkbox without a SelectionListener
would not send a request when checked but add the parameter to the next
request.

Regards, Ralf

Jesus Luna Quiroga wrote:
> Hi, I wrote a custom widget and it is sending the changes from the
> server to the client (browser), but the changes from the client
> (browser) to the server are not sending.
>
> I based my custom widget in the gmap example, I run the example and
> noticed that has the same behavior. In the debug I realized the changes
> are propagated until another control sends the request.
>
> In the JavaScript of the gmap example that sends the value I noticed it
> only adds the parameter to the request, but it doesn't send the request.
>
> if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var gmapId = wm.findIdByWidget( this );
> var center = this._map.getCenter().toString();
> var req = org.eclipse.swt.Request.getInstance();
> req.addParameter( gmapId + ".centerLocation", center );
>
> So, I found a method in the request object:
> org.eclipse.swt.Request.getInstance().send(), that sends the request, I
> added it and it worked.
>
> I have the doubt, is this the right mechanism for sending the request?
> And if it is, is just enough the call to the method? or do I need to
> flush the global queue events?


--
Ralf Sternberg

Need professional support for RAP and RCP?
http://www.eclipsesource.com/support/

Twitter: http://twitter.com/eclipsesource
Blog: http://www.eclipsesource.com/blogs/
Previous Topic:How to render the jsp file in the jetty server.
Next Topic:Disabling Session Cookies in Jetty, RAP cannot tabbed browsing in IE7 using the patch of bug 317616
Goto Forum:
  


Current Time: Fri Apr 26 12:47:05 GMT 2024

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

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

Back to the top