Chris,

Thanks for the prompt response.

Since there was no mention of parameter passing in the gadget
specification, I had a hunch that it may not be supported as yet. In the
absence of a standard mechanism, I was planning to take one of the
following routes:-

1) Instead of writing a URL gadget, write a small HTML gadget with the
following algorithm:-
        a) parse location.href to get the request parameters
        b) set url =  'http://localhost/sample/hello.do'
        c) for (each parameter in the url) set url = url +
parameter_name + '=' + parameter_value + '&';
        d) makeRequest(url, callback, {});
        e) get the HTML response of hello.do in callback() function and
set root div.innerHTML = response.text;

2) Since div.innerHTML would not execute <script> tags in the response
text, I'll have to parse the response text, extract the script tags and
add them to the DOM tree in step 1e.  Therefore, an easier way (no
additional coding) would be to set location.href = url in step(d)
instead of makeRequest; Step (e) is not required in this case.

Although step (2) looks attractive, I'm not sure if setting
location.href could break gadget rendering functionality of Shindig.
Kindly confirm.

Regards,
Vinod

-----Original Message-----
From: Chris Chabot [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2008 8:00 PM
To: shindig-dev@incubator.apache.org
Subject: Re: Passing HTTP request parameters to URL gadgets

Hey Vinod,

Currently that's not really possible unfortunately; There is a design
discussion going on for how to solve these use cases by extending the
templating proposal and allowing for such more clasic-style-
webdevelopment, but that will be a little while more before that's in
place.

What does work, although it's a bit of a work around, is fetching your
html output with an signed gadgets.io.makeRequest call, and parsing
the information along on it's url. see:
http://code.google.com/apis/opensocial/articles/makerequest-0.8.html

The you can take the response from that, put that in your root div
element... and you pretty much have the development model your looking
for; Not the cleanest solution, but functional until we have another
way to solve it.

Hope that helps!

        -- Chris


On Aug 25, 2008, at 1:10 PM, <[EMAIL PROTECTED]> wrote:

> Hi,
>
>
>
> I am looking for a solution to pass request parameters to a URL
> gadget.
> Here is an example of what I am trying to do:-
>
>
>
> 1)  I have a servlet that expects name in the HTTP request so that it
> can respond with a Hello <name> message
>
> 2)  I have created a URL gadget that points to my servlet like this:-
>
>
>
> <Module>
>
>       <ModulePrefs
>
>              title="Hello World Gadget"
>
>              directory_title="Simplest Gadget"
>
>              title_url="Hello World Gadget"
>
>              description="A very simple gadget."
>
>              height="120"
>
>              author="Vinod Pillai"
>
>       />
>
>       <Content href="http://localhost/sample/hello.do"; type="url"  />
>
> </Module>
>
>
>
>
>
>      Where http://localhost/sample/hello.do is the URL of my servlet.
>
>
>
> 3)  Is there a way to pass name as HTTP request parameter (GET or
> POST)
> to hello.do through known gadget APIs provided with Shindig
> distribution?
>
>
>
> Any suggestions/pointers are greatly appreciated.
>
>
>
> -vp
>
>
>
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of
> the addressee(s) and may contain proprietary, confidential or
> privileged information. If you are not the intended recipient, you
> should not disseminate, distribute or copy this e-mail. Please
> notify the sender immediately and destroy all copies of this message
> and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The
> recipient should check this email and any attachments for the
> presence of viruses. The company accepts no liability for any damage
> caused by any virus transmitted by this email.
>
> www.wipro.com


Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

Reply via email to