Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Not all requests from the client are send to the server through req.addParameter(...)?(When sending immediately multiple req.addParameter(...); req.send(); - only the last parameter arrives at the server. Why?)
icon5.gif  Not all requests from the client are send to the server through req.addParameter(...)? [message #528933] Thu, 22 April 2010 12:53 Go to next message
Eduard  is currently offline Eduard Friend
Messages: 29
Registered: September 2009
Junior Member
Hello RAP-Community!

I've created a custom widget and I am sending some paramaters form the client to the server through the following code:

var wm = org.eclipse.swt.WidgetManager.getInstance();
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( wm.findIdByWidget( this ) + ".PlayerEvent", args );
req.send();


When some paramaters are send immediately one after another, only the last parameter arrives at the server. If I send them with some delay inbetween it works.

I am using RAP M1.5 and the UICallback is active trough out the whole session.

Is that a bug? How does the 'Request' objekt actually work? Are the request paramaters buffered somehow at the clientside?

Best regards
Eduard Seibel
Re: Not all requests from the client are send to the server through req.addParameter(...)? [message #528959 is a reply to message #528933] Thu, 22 April 2010 13:51 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi Eduard.

Eduard schrieb:

> Is that a bug? How does the 'Request' objekt actually work? Are the
> request paramaters buffered somehow at the clientside?

Yes, they are buffered until the request is actually send. If you add
several parameters using the same name in the same call or within a few
milliseconds, the old values are overwritten. In your case, the names
are identical for the same widget. If you need all values, there are
several possibilites:

- Use different names if you have a limited number of parameters you
need to send at the same time. E.g.:
req.addParameter( wm.findIdByWidget( this ) + ".PlayerEvent.x", argX );
req.addParameter( wm.findIdByWidget( this ) + ".PlayerEvent.y", argY );

- Combine several values into one. You can use "req.getParameter( name
)" to retrieve the current value. It returns null if none is set yet.

- Use "req.sendSyncronous()" instead of "req.send()". However, this
blocks your client until the request is finished.

Hope that helps.

greetings,

Tim
icon14.gif  Re: Not all requests from the client are send to the server through req.addParameter(...)? [message #529006 is a reply to message #528933] Thu, 22 April 2010 15:38 Go to previous messageGo to next message
Eduard  is currently offline Eduard Friend
Messages: 29
Registered: September 2009
Junior Member
Hi Tim!

Thank you for your reply. That's exactly what I was looking for "req.synchroniousSend()". It works great!

Best Regards
Eduard Seibel
Re: Not all requests from the client are send to the server through req.addParameter(...)? [message #529029 is a reply to message #529006] Thu, 22 April 2010 16:05 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
it is *not* recommended to use syncronousSend() as it freezes the UI
while the request is running and thus easily leads to bad user
experience. Unless you have a very good reason prefer the send() function.

HTH
Rüdiger

On 22.04.2010 17:38, Eduard wrote:
> Hi Tim!
>
> Thank you for your reply. That's exactly what I was looking for
> "req.synchroniousSend()". It works great!
>
> Best Regards
> Eduard Seibel
Re: Not all requests from the client are send to the server through req.addParameter(...)? [message #529080 is a reply to message #528933] Thu, 22 April 2010 19:47 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Eduard,

it's right, the Request#send() function does not send requests
immediately. It waits for a very short period of time to collect
subsequent parameters to go into the same request.

If you send() the same parameter with a high frequency, not all of these
events will arrive at the server. A subsequent parameter value will
overwrite the previous one for the same parameter. In this case, I would
recommend to put those events into a queue and add a listener on the
send event that sets the parameter to the queued events and and clears
the queue.

Hope this helps,
Ralf

Eduard wrote:
> Hello RAP-Community!
>
> I've created a custom widget and I am sending some paramaters form the
> client to the server through the following code:
>
> var wm = org.eclipse.swt.WidgetManager.getInstance();
> var req = org.eclipse.swt.Request.getInstance();
> req.addParameter( wm.findIdByWidget( this ) + ".PlayerEvent", args );
> req.send();
>
> When some paramaters are send immediately one after another, only the
> last parameter arrives at the server. If I send them with some delay
> inbetween it works.
>
> I am using RAP M1.5 and the UICallback is active trough out the whole
> session.
>
> Is that a bug? How does the 'Request' objekt actually work? Are the
> request paramaters buffered somehow at the clientside?
>
> Best regards
> Eduard Seibel
Previous Topic:Communication from RAP to JavaScript
Next Topic:RAP on iPhone mobile safari
Goto Forum:
  


Current Time: Tue Dec 07 12:59:47 GMT 2021

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

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

Back to the top