On 14 Nov 2012, Ryan Baxter wrote: > If I had to guess that error is coming from RpcServlet.process. But it > looks like you would only get that is your JSON was invalid. I ran the > JSON in your email through a validator and it looks correct, so I am not > really sure. You might want to set a breakpoint in RpcServlet.process and > see if you see anything else.
An exception is thrown in the first line of the RpcServlet.process method:
JSONObject req = new JSONObject(body);
The message of the exception says
org.json.JSONException: A JSONObject text must begin with '{' at
character 1 of [{"method":"gadgets.metadata","id":"gadgets.metadata",
"params" ... "groupId":"@self"}}]
If I remove the '[' and '[' in the JSON string in the debugger (the array
has only a single element anyways), I got another exception:
org.json.JSONException: JSONObject["context"] not found.
So it seams the actual request is incorrect. Something with a "context"
field is expected but not sent.
Any ideas?
- martin
> On Wed, Nov 14, 2012 at 8:42 AM, Martin Hoeller <[email protected]> wrote:
>
> > Hi!
> >
> > Some time ago I supplied a patch for a sample maven archetype [0]. Ryan
> > mentioned that the archetype should rather use the common container
> > instead of the actually used (obsolete) one.
> >
> > I'm now trying to convert the archetype to use shindigs common-container
> > but I'm having some troubles...
> >
> > I use this code for loading gadgets:
> >
> > CommonContainer.preloadGadgets(gadgetUrls, function(result) {
> > for (var gadgetURL in result) {
> > if(!result[gadgetURL].error) {
> > window.buildGadget(result, gadgetURL);
> > curId++;
> > }
> > }
> > });
> >
> > However, preloadGadgets does an RPC call for gadget metadata and receives
> > a 400 BAD_REQUEST as result :(
> > The content of the response is "Malformed JSON request."
> >
> > Debuging showed that this was the data posted to the RPC Servlet:
> >
> > [
> > {"method":"gadgets.metadata",
> > "id":"gadgets.metadata",
> > "params":
> > {
> > "ids": [ "http://localhost:8080/myFirstGadget.xml",
> > "http://www.labpixies.com/campaigns/todo/todo.xml"],
> > "fields": ["iframeUrls",
> > "modulePrefs.*",
> > "needsTokenRefresh",
> > "userPrefs.*",
> > "views.preferredHeight",
> > "views.preferredWidth",
> > "expireTimeMs",
> > "responseTimeMs",
> > "rpcServiceIds",
> > "tokenTTL"],
> > "language":"de",
> > "country":"DE",
> > "userId":"@viewer",
> > "groupId":"@self"
> > }
> > }
> > ]
> >
> > This data is generated by some shindig JavaScript code. Does anybody have
> > any idea what I'm doing wrong? I just want to use common-container to
> > display two gadgets. Can this be so hard?
> >
> > Many thanks in advance,
> > - martin
> >
> > [0] https://issues.apache.org/jira/browse/SHINDIG-1482
> >
--
Martin Höller | [email protected]
*x Software + Systeme | http://www.xss.co.at/
Karmarschgasse 51/2/20 | Tel: +43-1-6060114-40
A-1100 Vienna, Austria | Fax: +43-1-6060114-71
signature.asc
Description: PGP signature
