On Tue, Mar 25, 2008 at 2:40 AM, Martin Webb <[EMAIL PROTECTED]>
wrote:

> Kevin,
>
> I'm running a gadget container on a different domain/port than the gadget
> server - and thus cannot directly call the metadata servlet fromt he
> browser
> using JSON with POST.  I'd rather not clone the servlet code and copy into
> my gadget container...  Which is why I asked (in another thread) if it
> could
> be possible to package the servlets up into a JAR (possibly with as many
> as
> a the core classes as needed).


The metadata APIs are actually designed under the assumption that they'll be
called from your server side code that generates your parent page. On a
production site, this is critical for scalability and end user latency, and
it's the only way you'd be able to generate security tokens (essential for
supporting "real" opensocial deployments). Calling them from javascript is
useful for illustrative purposes, but it's definitely *not* the intended
production deployment situation.

A typical gadget-containing parent page should have a flow something like
this:

- Fetch user data from back end
- Determine which gadgets to render for the user
- Fetch gadget metadata from metadata service (optionally caching responses
if appropriate)
- Append security tokens or other request-specific details to the response
data
- Generate output html, including iframe code.

If your production site is already using Java, you could always just use the
core code directly in your front end as well (no need to "clone" anything).
This limits scaling opportunities, but it should be fine for small to medium
sites.

-- 
~Kevin

Reply via email to