shindig-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Rhodes <motley.crue....@gmail.com>
Subject Weird "Malformed JSON" problem with Shindig
Date Thu, 23 Dec 2010 08:16:53 GMT
Hi guys, hoping somebody can help me with a little problem I'm having with
Shindig...

What I have is this:  I've built Shindig from SVN, using the latest code
from trunk.  I've deployed to Tomcat 6.0.26, with Shindig
as the ROOT webapp.  I can browse to <
http://localhost:8080/container/sample1.html> and see both gadgets rendered
and working.  So, Shindig is fundamentally functional.  Ok...

Now here's where it gets weird.  I'm trying to integrate Shindig into my
application, so I setup a page that basically
mimics the content of sample1.html.  It's a Grails app, and is deployed to
the same Tomcat instance, but in a context
of 'quoddy2/'.  I'm reaching the page through a URL of <
http://localhost:8080/quoddy2/opensocial> and at runtime the
generated HTML includes this bit, copied almost verbatim from sample1.html:

		<!-- default container look and feel -->
		<link rel="stylesheet" href="/quoddy2/css/gadgets.css
<view-source:http://localhost:8080/quoddy2/css/gadgets.css>">
		<script type="text/javascript"
src="../gadgets/js/shindig-container:rpc.js?c=1&debug=1&nocache=1
<view-source:http://localhost:8080/gadgets/js/shindig-container:rpc.js?c=1&debug=1&nocache=1>"></script>
		<script type="text/javascript">
			var specUrl0 = 'http://www.google.com/ig/modules/horoscope.xml';
			var specUrl1 = 'http://www.labpixies.com/campaigns/todo/todo.xml';

			// This container lays out and renders gadgets itself.

			function renderGadgets() {
  			var gadget0 = shindig.container.createGadget({specUrl: specUrl0});
  			var gadget1 = shindig.container.createGadget({specUrl: specUrl1});

			shindig.container.addGadget(gadget0);
  			shindig.container.addGadget(gadget1);
  			shindig.container.layoutManager.setGadgetChromeIds(
      		['gadget-chrome-x', 'gadget-chrome-y']);
			shindig.container.renderGadget(gadget0);
  			shindig.container.renderGadget(gadget1);
			};
		</script>


the <body onload="">  bit is there, as are the two divs for the
gadgets.  But, no gadget is rendered.  I am getting back a response

from a call to /gadgets/metadata of "Malformed JSON response."
Debugging into the RpcServlet, I've found that, sure enough, the JSON
that

comes in is different depending on which URL I used.  In the working
case, (sample1.html from the actual Shindig deployment) I get (for the
first gadget):


{"context":{"country":"default","language":"default","view":"default","container":"default"},"gadgets":[{"url":"http://www.google.com/ig/modules/horoscope.xml","moduleId":1}]}


But when I load my page, the JSON that is sent looks like:

{"context":{"country":"default","language":"default","view":"default","container":"default"},"gadgets":"[{\"url\":
\"http://www.google.com/ig/modules/horoscope.xml\", \"moduleId\":
1}]"}


and the JSON parser complains that "gadgets is not a valid JSON array."

Sooo... there seems to be something very subtle going on here, that I'm
missing.  Why would I get the JSON with the escaped quotes in one case, when
everything else seems to be
essentially the same?

I'm not much a browser / javascript / client-side guy, so please forgive my
ignorance if this is something obvious!


Thanks,


Phillip Rhodes
Fogbeam Labs

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message