You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Martin Hoeller <ma...@xss.co.at> on 2013/01/07 13:32:53 UTC
Re: how to set the moduleId
Hi Ryan!
Sorry for late reply but I was on vacation...
I ended up redefining the method
osapi.container.GadgetSite.setModuleId_() in one of my own JavaScrip
files and set the private moduleId_ field always. This works for me,
but skips some code which might have it's value.
Though, I still feel Shindig's behavior is wrong, it could be that I
am missing something.
regards,
- martin
Am Wed, 26 Dec 2012 10:46:14 -0500 schrieb Ryan Baxter
<rb...@apache.org>:
> Martin did you debug this further? Seems like it should be set when
> GadgetSite.navigateTo is called.
>
>
> On Thu, Dec 13, 2012 at 11:54 AM, Martin Hoeller <ma...@xss.co.at>
> wrote:
>
> > Hi!
> >
> > I have a number of gadgets on a page that I render basically like
> > this:
> >
> > CommonContainer.preloadGadgets(...);
> > var params = {};
> > params[osapi.container.RenderParam.MODULE_ID] = spec.modId;
> > var gadgetSite = CommonContainer.newGadgetSite(el);
> > var gadgetURL = spec.url;
> > CommonContainer.navigateGadget(gadgetSite, gadgetURL, {},
> > params);
> >
> > "spec" is an object containing meta-information for a gadget (like
> > URL and module-ID).
> >
> > Rendering works, and the correct moduleId is passed to the server,
> > but when I query the moduleId afterwards via
> > gadgetSite.getModuleId() I always get "0" as the result.
> >
> > What am I missing here?
> > Or what is the recommended way to tell the common container the
> > ModuleId for a gadget?
> >
> > tia,
> > - martin
> >
Re: how to set the moduleId
Posted by Martin Hoeller <ma...@xss.co.at>.
Am Mon, 7 Jan 2013 14:49:24 -0500 schrieb Ryan Baxter
<rb...@apache.org>:
> Yes I think you are right seems like a bug. Want to create a patch
> and a review for it?
Done.
JIRA: https://issues.apache.org/jira/browse/SHINDIG-1891
Review: https://reviews.apache.org/r/8870/
hth,
- martin
Re: how to set the moduleId
Posted by Ryan Baxter <rb...@apache.org>.
Yes I think you are right seems like a bug. Want to create a patch and a
review for it?
On Mon, Jan 7, 2013 at 2:23 PM, Martin Hoeller <ma...@xss.co.at> wrote:
> Hi Ryan!
>
> Am Mon, 7 Jan 2013 13:32:42 -0500 schrieb Ryan Baxter <
> rbaxter85@apache.org>:
>
> > Hope your vacation went well. I would debug through the navigateTo
> > call to see what is happening. Looks like it should be called from
> > there.
>
> Actually I did this (a few weeks ago) but stopped in the
> getGadgetToken() method. (debuging someone else's JavaScript Code is
> really not my passion ;)
>
> I had a quick look again and it seems, this method is broken. It's
> defined in service.js and has the following code in it:
>
> // Otherwise, cache response. Augment final response with server
> response.
> } else {
> for (var id in response) {
> var mid = response[osapi.container.TokenResponse.MODULE_ID],
> url = osapi.container.util.buildTokenRequestUrl(id, mid);
>
> //response[id]['url'] = id; // make sure url is set
> self.cachedTokens_[url] = response[id];
> finalResponse[id] = response[id];
> }
> }
>
> The line where "mid" is initialized seems broken. "response" is an
> object with the URL as field (something like an associative array), so
> response[osapi.container.TokenResponse.MODULE_ID] is undefined.
>
> Changing
> var mid = response[osapi.container.TokenResponse.MODULE_ID],
> to
> var mid = response[id][osapi.container.TokenResponse.MODULE_ID],
> could help, but someone with more experience should have a closer look
> to verify it.
>
> What do you think?
>
> - martin
>
Re: how to set the moduleId
Posted by Ryan Baxter <rb...@apache.org>.
Yes I think you are right seems like a bug. Want to create a patch and a
review for it?
On Mon, Jan 7, 2013 at 2:23 PM, Martin Hoeller <ma...@xss.co.at> wrote:
> Hi Ryan!
>
> Am Mon, 7 Jan 2013 13:32:42 -0500 schrieb Ryan Baxter <
> rbaxter85@apache.org>:
>
> > Hope your vacation went well. I would debug through the navigateTo
> > call to see what is happening. Looks like it should be called from
> > there.
>
> Actually I did this (a few weeks ago) but stopped in the
> getGadgetToken() method. (debuging someone else's JavaScript Code is
> really not my passion ;)
>
> I had a quick look again and it seems, this method is broken. It's
> defined in service.js and has the following code in it:
>
> // Otherwise, cache response. Augment final response with server
> response.
> } else {
> for (var id in response) {
> var mid = response[osapi.container.TokenResponse.MODULE_ID],
> url = osapi.container.util.buildTokenRequestUrl(id, mid);
>
> //response[id]['url'] = id; // make sure url is set
> self.cachedTokens_[url] = response[id];
> finalResponse[id] = response[id];
> }
> }
>
> The line where "mid" is initialized seems broken. "response" is an
> object with the URL as field (something like an associative array), so
> response[osapi.container.TokenResponse.MODULE_ID] is undefined.
>
> Changing
> var mid = response[osapi.container.TokenResponse.MODULE_ID],
> to
> var mid = response[id][osapi.container.TokenResponse.MODULE_ID],
> could help, but someone with more experience should have a closer look
> to verify it.
>
> What do you think?
>
> - martin
>
Re: how to set the moduleId
Posted by Martin Hoeller <ma...@xss.co.at>.
Hi Ryan!
Am Mon, 7 Jan 2013 13:32:42 -0500 schrieb Ryan Baxter <rb...@apache.org>:
> Hope your vacation went well. I would debug through the navigateTo
> call to see what is happening. Looks like it should be called from
> there.
Actually I did this (a few weeks ago) but stopped in the
getGadgetToken() method. (debuging someone else's JavaScript Code is
really not my passion ;)
I had a quick look again and it seems, this method is broken. It's
defined in service.js and has the following code in it:
// Otherwise, cache response. Augment final response with server response.
} else {
for (var id in response) {
var mid = response[osapi.container.TokenResponse.MODULE_ID],
url = osapi.container.util.buildTokenRequestUrl(id, mid);
//response[id]['url'] = id; // make sure url is set
self.cachedTokens_[url] = response[id];
finalResponse[id] = response[id];
}
}
The line where "mid" is initialized seems broken. "response" is an
object with the URL as field (something like an associative array), so
response[osapi.container.TokenResponse.MODULE_ID] is undefined.
Changing
var mid = response[osapi.container.TokenResponse.MODULE_ID],
to
var mid = response[id][osapi.container.TokenResponse.MODULE_ID],
could help, but someone with more experience should have a closer look
to verify it.
What do you think?
- martin
Re: how to set the moduleId
Posted by Martin Hoeller <ma...@xss.co.at>.
Hi Ryan!
Am Mon, 7 Jan 2013 13:32:42 -0500 schrieb Ryan Baxter <rb...@apache.org>:
> Hope your vacation went well. I would debug through the navigateTo
> call to see what is happening. Looks like it should be called from
> there.
Actually I did this (a few weeks ago) but stopped in the
getGadgetToken() method. (debuging someone else's JavaScript Code is
really not my passion ;)
I had a quick look again and it seems, this method is broken. It's
defined in service.js and has the following code in it:
// Otherwise, cache response. Augment final response with server response.
} else {
for (var id in response) {
var mid = response[osapi.container.TokenResponse.MODULE_ID],
url = osapi.container.util.buildTokenRequestUrl(id, mid);
//response[id]['url'] = id; // make sure url is set
self.cachedTokens_[url] = response[id];
finalResponse[id] = response[id];
}
}
The line where "mid" is initialized seems broken. "response" is an
object with the URL as field (something like an associative array), so
response[osapi.container.TokenResponse.MODULE_ID] is undefined.
Changing
var mid = response[osapi.container.TokenResponse.MODULE_ID],
to
var mid = response[id][osapi.container.TokenResponse.MODULE_ID],
could help, but someone with more experience should have a closer look
to verify it.
What do you think?
- martin
Re: how to set the moduleId
Posted by Ryan Baxter <rb...@apache.org>.
Hope your vacation went well. I would debug through the navigateTo call to
see what is happening. Looks like it should be called from there.
On Mon, Jan 7, 2013 at 7:32 AM, Martin Hoeller <ma...@xss.co.at> wrote:
> Hi Ryan!
>
> Sorry for late reply but I was on vacation...
>
> I ended up redefining the method
> osapi.container.GadgetSite.setModuleId_() in one of my own JavaScrip
> files and set the private moduleId_ field always. This works for me,
> but skips some code which might have it's value.
>
> Though, I still feel Shindig's behavior is wrong, it could be that I
> am missing something.
>
> regards,
> - martin
>
> Am Wed, 26 Dec 2012 10:46:14 -0500 schrieb Ryan Baxter
> <rb...@apache.org>:
>
> > Martin did you debug this further? Seems like it should be set when
> > GadgetSite.navigateTo is called.
> >
> >
> > On Thu, Dec 13, 2012 at 11:54 AM, Martin Hoeller <ma...@xss.co.at>
> > wrote:
> >
> > > Hi!
> > >
> > > I have a number of gadgets on a page that I render basically like
> > > this:
> > >
> > > CommonContainer.preloadGadgets(...);
> > > var params = {};
> > > params[osapi.container.RenderParam.MODULE_ID] = spec.modId;
> > > var gadgetSite = CommonContainer.newGadgetSite(el);
> > > var gadgetURL = spec.url;
> > > CommonContainer.navigateGadget(gadgetSite, gadgetURL, {},
> > > params);
> > >
> > > "spec" is an object containing meta-information for a gadget (like
> > > URL and module-ID).
> > >
> > > Rendering works, and the correct moduleId is passed to the server,
> > > but when I query the moduleId afterwards via
> > > gadgetSite.getModuleId() I always get "0" as the result.
> > >
> > > What am I missing here?
> > > Or what is the recommended way to tell the common container the
> > > ModuleId for a gadget?
> > >
> > > tia,
> > > - martin
> > >
>
Re: how to set the moduleId
Posted by Ryan Baxter <rb...@apache.org>.
Hope your vacation went well. I would debug through the navigateTo call to
see what is happening. Looks like it should be called from there.
On Mon, Jan 7, 2013 at 7:32 AM, Martin Hoeller <ma...@xss.co.at> wrote:
> Hi Ryan!
>
> Sorry for late reply but I was on vacation...
>
> I ended up redefining the method
> osapi.container.GadgetSite.setModuleId_() in one of my own JavaScrip
> files and set the private moduleId_ field always. This works for me,
> but skips some code which might have it's value.
>
> Though, I still feel Shindig's behavior is wrong, it could be that I
> am missing something.
>
> regards,
> - martin
>
> Am Wed, 26 Dec 2012 10:46:14 -0500 schrieb Ryan Baxter
> <rb...@apache.org>:
>
> > Martin did you debug this further? Seems like it should be set when
> > GadgetSite.navigateTo is called.
> >
> >
> > On Thu, Dec 13, 2012 at 11:54 AM, Martin Hoeller <ma...@xss.co.at>
> > wrote:
> >
> > > Hi!
> > >
> > > I have a number of gadgets on a page that I render basically like
> > > this:
> > >
> > > CommonContainer.preloadGadgets(...);
> > > var params = {};
> > > params[osapi.container.RenderParam.MODULE_ID] = spec.modId;
> > > var gadgetSite = CommonContainer.newGadgetSite(el);
> > > var gadgetURL = spec.url;
> > > CommonContainer.navigateGadget(gadgetSite, gadgetURL, {},
> > > params);
> > >
> > > "spec" is an object containing meta-information for a gadget (like
> > > URL and module-ID).
> > >
> > > Rendering works, and the correct moduleId is passed to the server,
> > > but when I query the moduleId afterwards via
> > > gadgetSite.getModuleId() I always get "0" as the result.
> > >
> > > What am I missing here?
> > > Or what is the recommended way to tell the common container the
> > > ModuleId for a gadget?
> > >
> > > tia,
> > > - martin
> > >
>