So the GadgetDataServlet class is being deprecated. The new code which you
should switch to soon is the DataServiceServlet.

Anyway, testing both is pretty similar. You can either write a gadget to
send requests up to the server and load it into the samplecontainer.html
page. Or, you can just open firebug inside any current gadget and execute
away. For the latter, I use some code like this to test the various restful
responses (ie the ones that DataServiceServlet responds to)

  // Whatever you feel like posting. This is currently using the json batch
format.
  var jsonBatchData =
{"key":{"url":"/appdata/@viewer/@self/@app","method":"POST",
                  "postData":{"test":"Cassie gave Erel a cashew nut"}}};

  // The params you pass to makeRequest
  var makeRequestParams = {
    "CONTENT_TYPE" : "JSON",
    "METHOD" : "POST",
    "POST_DATA" : gadgets.json.stringify(jsonBatchData)
  };

// The actual request that goes to your server and does stuff
gadgets.io.makeRequest(
    'http://<your server and port>/social/rest/jsonBatch?st=<grab a security
token from the sample container>',
    function(result) { window.console.log(result); },
    makeRequestParams);


You can follow this model to test anything by just changing the url and the
postData to match whatever request you want to make.. then just firebug
away!

- Cassie




On Wed, Jul 16, 2008 at 4:18 AM, Erel Segal <[EMAIL PROTECTED]> wrote:

> What is the best way to debug the GadgetDataServlet class?
>
> I would like to post a request in JSON format, and trace the calculation.
> Should I write a form, or is there already a form that does this?
>

Reply via email to