You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Bastian Hofmann <BH...@vz.net> on 2010/07/21 17:16:50 UTC
Handling responses of os:HttpRequest
Hi,
we are currently migrating our PHP shindig deployment to the current trunk. While testing the os:HttpRequest Tag I came around a significant difference between the PHP Shindig and the tutorial in the OpenSocial wiki.
http://wiki.opensocial.org/index.php?title=OpenSocial_Templates_Developer%27s_Guide#Fetching_data_from_a_URL
says that a Json construct like this
{
friends : [
{
name: 'David',
interests: 'Cooking',
},
{
name: 'Charles',
interests: 'Hiking',
},
{
name: 'Mary',
interests: 'Football',
},
]
}
can be fetched with
<os:HttpRequest key="friends" href="http://myfriendsserver.com"/>
and viewed with
<li repeat="${friends}">
<span>Name: ${Cur.name} Hobby: ${Cur.interests}</span>
</li>
The current PHP implementation handles this a bit differently:
<li repeat="${friends.result.content.friends}">
<span>Name: ${Cur.name} Hobby: ${Cur.interests}</span>
</li>
Here the first "friends" is the key of the os:HttpRequest, "result" and "content" come from the php implementation and the second "friends" is from the json object.
Which is the right implementation and how is it done in the Java Shindig?
I looked into the spec http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/OpenSocial-Data-Pipelining.html#HttpRequest and it seems that the PHP way is correct instead of the tutorial. Should I change the tutorial or submit a patch to the PHP Shindig?
Best regards
Bastian
VZnet Netzwerke Ltd. || Saarbruecker Str. 38 || D - 10405 Berlin
Tel: +49 (30) 4050427 513
Fax:
Mobil:
BHofmann@vz.net
http://www.studivz.net/bastian
www.studivz.net, www.meinvz.net, www.schuelervz.net
VZnet Netzwerke Limited, Registered Office Berlin, Registration Court Charlottenburg, HRB 101454
Executive Directors: Clemens Riedl, Thomas Baum
Non-Executive Directors: Dr. Michael Brockhaus, Martin Weber, Claas van Delden
Headquarters: VZnet Netzwerke Limited, 5 New Street Square, London EC4A 3TW, United Kingdom
Companies House Cardiff No. 5607971, Place of Registration: England and Wales
Re: Handling responses of os:HttpRequest
Posted by Bastian Hofmann <BH...@vz.net>.
Hey,
I just wanted to pop this up. Any comments? If not, than I'd propose that I change the tutorial in the wiki according to the PHP implementation and Spec example.
Best regards
Bastian
Am 21.07.2010 um 17:16 schrieb Bastian Hofmann:
> Hi,
>
> we are currently migrating our PHP shindig deployment to the current trunk. While testing the os:HttpRequest Tag I came around a significant difference between the PHP Shindig and the tutorial in the OpenSocial wiki.
>
> http://wiki.opensocial.org/index.php?title=OpenSocial_Templates_Developer%27s_Guide#Fetching_data_from_a_URL
>
> says that a Json construct like this
>
> {
> friends : [
> {
> name: 'David',
> interests: 'Cooking',
> },
> {
> name: 'Charles',
> interests: 'Hiking',
> },
> {
> name: 'Mary',
> interests: 'Football',
> },
> ]
> }
>
> can be fetched with
>
> <os:HttpRequest key="friends" href="http://myfriendsserver.com"/>
> and viewed with
>
> <li repeat="${friends}">
> <span>Name: ${Cur.name} Hobby: ${Cur.interests}</span>
> </li>
>
> The current PHP implementation handles this a bit differently:
>
> <li repeat="${friends.result.content.friends}">
> <span>Name: ${Cur.name} Hobby: ${Cur.interests}</span>
> </li>
>
> Here the first "friends" is the key of the os:HttpRequest, "result" and "content" come from the php implementation and the second "friends" is from the json object.
>
> Which is the right implementation and how is it done in the Java Shindig?
>
> I looked into the spec http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/OpenSocial-Data-Pipelining.html#HttpRequest and it seems that the PHP way is correct instead of the tutorial. Should I change the tutorial or submit a patch to the PHP Shindig?
>
> Best regards
>
> Bastian
>
> VZnet Netzwerke Ltd. || Saarbruecker Str. 38 || D - 10405 Berlin
>
> Tel: +49 (30) 4050427 513
> Fax:
> Mobil:
>
> BHofmann@vz.net
> http://www.studivz.net/bastian
>
> www.studivz.net, www.meinvz.net, www.schuelervz.net
>
> VZnet Netzwerke Limited, Registered Office Berlin, Registration Court Charlottenburg, HRB 101454
> Executive Directors: Clemens Riedl, Thomas Baum
> Non-Executive Directors: Dr. Michael Brockhaus, Martin Weber, Claas van Delden
> Headquarters: VZnet Netzwerke Limited, 5 New Street Square, London EC4A 3TW, United Kingdom
> Companies House Cardiff No. 5607971, Place of Registration: England and Wales
>
>
> VZnet Netzwerke Ltd. || Saarbruecker Str. 38 || D - 10405 Berlin
>
> Tel: +49 (30) 4050427 513
> Fax:
> Mobil:
>
> BHofmann@vz.net
> http://www.studivz.net/bastian
>
> www.studivz.net, www.meinvz.net, www.schuelervz.net
>
> VZnet Netzwerke Limited, Registered Office Berlin, Registration Court Charlottenburg, HRB 101454
> Executive Directors: Clemens Riedl, Thomas Baum
> Non-Executive Directors: Dr. Michael Brockhaus, Martin Weber, Claas van Delden
> Headquarters: VZnet Netzwerke Limited, 5 New Street Square, London EC4A 3TW, United Kingdom
> Companies House Cardiff No. 5607971, Place of Registration: England and Wales
>
VZnet Netzwerke Ltd. || Saarbruecker Str. 38 || D - 10405 Berlin
Tel: +49 (30) 4050427 513
Fax:
Mobil:
BHofmann@vz.net
http://www.studivz.net/bastian
www.studivz.net, www.meinvz.net, www.schuelervz.net
VZnet Netzwerke Limited, Registered Office Berlin, Registration Court Charlottenburg, HRB 101454
Executive Directors: Clemens Riedl, Thomas Baum
Non-Executive Directors: Dr. Michael Brockhaus, Martin Weber, Claas van Delden
Headquarters: VZnet Netzwerke Limited, 5 New Street Square, London EC4A 3TW, United Kingdom
Companies House Cardiff No. 5607971, Place of Registration: England and Wales