Skip to main content



      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 08:53 Go to next message
Eclipse UserFriend
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 09:51 Go to previous messageGo to next message
Eclipse UserFriend
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 11:38 Go to previous messageGo to next message
Eclipse UserFriend
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 12:05 Go to previous messageGo to next message
Eclipse UserFriend
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 15:47 Go to previous message
Eclipse UserFriend
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: Mon Jul 14 21:42:08 EDT 2025

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

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

Back to the top