You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Zhenhua Guo <je...@gmail.com> on 2010/10/29 20:55:10 UTC

proxy and makeRequest processing logic

We are building science portal using Shindig and converting existing
web app frontends to gadgets. Those web app frontends access backend
services. To convert them to gadgets, the usual way is to rewrite
those calls using gadgets.io.makeRequest. The problem is that this is
not always desired. For example, a web app uses YUI library to create
a table and populate it with data loaded from remote server. The data
loading is managed by YUI. So to rewrite it requires non-trivial work
(data loading, table update, auto update, etc).
Our current solution is to construct makeRequest URL directly
(gadges/makeRequest?url=...) and give the URL to YUI data loading
function. Of course this is a hack instead elegant solution.

My question is whether I can use getProxyUrl and send requests there.
I know makeRequest and getProxyUrl are handled by different servlets.
What are the main differences of their processing logic?

Thanks

Gerald

Re: proxy and makeRequest processing logic

Posted by Jacobo Tarrio <jt...@gmail.com>.
 Yes, it would be something like <Require feature="shindig.xhrwrapper" />

On Fri, Oct 29, 2010 at 6:59 PM, Zhenhua Guo <je...@gmail.com> wrote:

> Thanks, Jacobo
> See my comments below.
>
> On Fri, Oct 29, 2010 at 4:14 PM, Jacobo Tarrio <jt...@gmail.com> wrote:
> >  No, that will not work. makeRequest requests and responses come in their
> > own format, which YUI will not be able to use.
> Actually, we wrote several functions to parse the returned data and
> extract useful information.
>
> >  If YUI uses XmlHttpRequest to perform those requests, you may try using
> the
> > shindig.xhrwrapper feature, which intercepts the XmlHttpRequest calls and
> > emulates them using makeRequest. If it uses JSONP, this will not be
> useful,
> > but then you would probably need no extra special hacks to make JSONP
> work
> > anyway :)
> Thanks!. I will look into shindig.xhrwrapper feature. Should I add
> element "<Require feature=.../>" to my gadget xml file?
>
> > On Fri, Oct 29, 2010 at 11:55 AM, Zhenhua Guo <je...@gmail.com> wrote:
> >
> >> We are building science portal using Shindig and converting existing
> >> web app frontends to gadgets. Those web app frontends access backend
> >> services. To convert them to gadgets, the usual way is to rewrite
> >> those calls using gadgets.io.makeRequest. The problem is that this is
> >> not always desired. For example, a web app uses YUI library to create
> >> a table and populate it with data loaded from remote server. The data
> >> loading is managed by YUI. So to rewrite it requires non-trivial work
> >> (data loading, table update, auto update, etc).
> >> Our current solution is to construct makeRequest URL directly
> >> (gadges/makeRequest?url=...) and give the URL to YUI data loading
> >> function. Of course this is a hack instead elegant solution.
> >>
> >> My question is whether I can use getProxyUrl and send requests there.
> >> I know makeRequest and getProxyUrl are handled by different servlets.
> >> What are the main differences of their processing logic?
> >>
> >> Thanks
> >>
> >> Gerald
> >>
> >
> >
> >
> > --
> >   Jacobo Tarrío     |     http://jacobo.tarrio.org/
> >
>



-- 
   Jacobo Tarrío     |     http://jacobo.tarrio.org/

Re: proxy and makeRequest processing logic

Posted by Zhenhua Guo <je...@gmail.com>.
Thanks, Jacobo
See my comments below.

On Fri, Oct 29, 2010 at 4:14 PM, Jacobo Tarrio <jt...@gmail.com> wrote:
>  No, that will not work. makeRequest requests and responses come in their
> own format, which YUI will not be able to use.
Actually, we wrote several functions to parse the returned data and
extract useful information.

>  If YUI uses XmlHttpRequest to perform those requests, you may try using the
> shindig.xhrwrapper feature, which intercepts the XmlHttpRequest calls and
> emulates them using makeRequest. If it uses JSONP, this will not be useful,
> but then you would probably need no extra special hacks to make JSONP work
> anyway :)
Thanks!. I will look into shindig.xhrwrapper feature. Should I add
element "<Require feature=.../>" to my gadget xml file?

> On Fri, Oct 29, 2010 at 11:55 AM, Zhenhua Guo <je...@gmail.com> wrote:
>
>> We are building science portal using Shindig and converting existing
>> web app frontends to gadgets. Those web app frontends access backend
>> services. To convert them to gadgets, the usual way is to rewrite
>> those calls using gadgets.io.makeRequest. The problem is that this is
>> not always desired. For example, a web app uses YUI library to create
>> a table and populate it with data loaded from remote server. The data
>> loading is managed by YUI. So to rewrite it requires non-trivial work
>> (data loading, table update, auto update, etc).
>> Our current solution is to construct makeRequest URL directly
>> (gadges/makeRequest?url=...) and give the URL to YUI data loading
>> function. Of course this is a hack instead elegant solution.
>>
>> My question is whether I can use getProxyUrl and send requests there.
>> I know makeRequest and getProxyUrl are handled by different servlets.
>> What are the main differences of their processing logic?
>>
>> Thanks
>>
>> Gerald
>>
>
>
>
> --
>   Jacobo Tarrío     |     http://jacobo.tarrio.org/
>

Re: proxy and makeRequest processing logic

Posted by Jacobo Tarrio <jt...@gmail.com>.
 No, that will not work. makeRequest requests and responses come in their
own format, which YUI will not be able to use.

 If YUI uses XmlHttpRequest to perform those requests, you may try using the
shindig.xhrwrapper feature, which intercepts the XmlHttpRequest calls and
emulates them using makeRequest. If it uses JSONP, this will not be useful,
but then you would probably need no extra special hacks to make JSONP work
anyway :)

On Fri, Oct 29, 2010 at 11:55 AM, Zhenhua Guo <je...@gmail.com> wrote:

> We are building science portal using Shindig and converting existing
> web app frontends to gadgets. Those web app frontends access backend
> services. To convert them to gadgets, the usual way is to rewrite
> those calls using gadgets.io.makeRequest. The problem is that this is
> not always desired. For example, a web app uses YUI library to create
> a table and populate it with data loaded from remote server. The data
> loading is managed by YUI. So to rewrite it requires non-trivial work
> (data loading, table update, auto update, etc).
> Our current solution is to construct makeRequest URL directly
> (gadges/makeRequest?url=...) and give the URL to YUI data loading
> function. Of course this is a hack instead elegant solution.
>
> My question is whether I can use getProxyUrl and send requests there.
> I know makeRequest and getProxyUrl are handled by different servlets.
> What are the main differences of their processing logic?
>
> Thanks
>
> Gerald
>



-- 
   Jacobo Tarrío     |     http://jacobo.tarrio.org/