|
Re: a custom widget that make ajax call to communicate with the rap server [message #537133 is a reply to message #536828] |
Tue, 01 June 2010 12:37 |
|
Hi Owen,
first of all, wouldn't it be better to let the server do the github
fetch? I guess this would fit better with RAP's server-side application
paradigm. The client should only render the user interface.
We plan to provide a new API on the client with the introduction of a
protocol between client and server (bug 311355). Until then you can use
code like the following to add a request parameter to an Ajax call:
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( "your.parameter", value );
req.send();
If a custom widget triggers this call, the parameter should be prefixed
with it's widget id.
Does this answer your question?
Regards, Ralf
Owen wrote:
> Hi,
>
> RIght now I am making a widget that is able to make ajax calls to Github
> API (http://develop.github.com/) getting the content, and then send the
> content back to the rap server. The followings are the steps that I
> wanna achieve:
>
> 1. rap server asks the rap client to make an ajax call to GitHub
> 2. rap client makes an ajax call to GitHub and gets the content
> 3. rap client sends this content back to the rap server for further
> processing
> 4. rap server update the rap client
>
> Here is the flow:
>
> rap server (1)-> rap client (2)-> GitHub server (2)-> rap client (3)->
> rap server (4)-> rap client
>
> Step 1 and 2 are easy to achieved with a QooXDoo plugin and there are
> examples for that already, e.g.,
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. rap.help/help/html/advanced/custom-widget.html
> But I am having trouble building the custom event mechanism the makes
> ajax calls back between the rap client and the rap server (3 in this
> example). Is there any API I can use? Or is there an example I can take
> a look at?
>
> Many thanks,
> Owen
|
|
|
Re: a custom widget that make ajax call to communicate with the rap server [message #537209 is a reply to message #537133] |
Tue, 01 June 2010 15:24 |
Owen Messages: 17 Registered: May 2010 |
Junior Member |
|
|
Hi Ralf,
Thanks for the reply.
Yup, we did consider using server to fetch the content, but somehow there are API call limits in github, that's why we wanna put this on the client.
Another thing is I am not sure if it's possible to make a headless widget in this respect : making ajax calls to other server and then transfer the content back to the rap server. Could u give me some pointers on this?
Many thanks,
Owen
Ralf Sternberg wrote on Tue, 01 June 2010 08:37 | Hi Owen,
first of all, wouldn't it be better to let the server do the github
fetch? I guess this would fit better with RAP's server-side application
paradigm. The client should only render the user interface.
We plan to provide a new API on the client with the introduction of a
protocol between client and server (bug 311355). Until then you can use
code like the following to add a request parameter to an Ajax call:
var req = org.eclipse.swt.Request.getInstance();
req.addParameter( "your.parameter", value );
req.send();
If a custom widget triggers this call, the parameter should be prefixed
with it's widget id.
Does this answer your question?
Regards, Ralf
Owen wrote:
> Hi,
>
> RIght now I am making a widget that is able to make ajax calls to Github
> API (http://develop.github.com/) getting the content, and then send the
> content back to the rap server. The followings are the steps that I
> wanna achieve:
>
> 1. rap server asks the rap client to make an ajax call to GitHub
> 2. rap client makes an ajax call to GitHub and gets the content
> 3. rap client sends this content back to the rap server for further
> processing
> 4. rap server update the rap client
>
> Here is the flow:
>
> rap server (1)-> rap client (2)-> GitHub server (2)-> rap client (3)->
> rap server (4)-> rap client
>
> Step 1 and 2 are easy to achieved with a QooXDoo plugin and there are
> examples for that already, e.g.,
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. rap.help/help/html/advanced/custom-widget.html
> But I am having trouble building the custom event mechanism the makes
> ajax calls back between the rap client and the rap server (3 in this
> example). Is there any API I can use? Or is there an example I can take
> a look at?
>
> Many thanks,
> Owen
|
|
|
|
Powered by
FUDForum. Page generated in 0.03852 seconds