Review Board 1.7.22


Shindig does not accept relative URLs for template libraries

Review Request #4818 - Created April 20, 2012 and submitted

Erik Bi
shindig-1548
Reviewers
shindig
ddumont, rbaxter, ssievers
shindig
per spec, Gadget should be able to use relative URL to define the template-libray, but right now when it uses this approach, client side will end up making a /gadgets/makeRequest call and passes in the relative URL value and fails with an HTTP status of 400.

Solution: 
At client side, the opensocial-template feature will get the template-library URL value from global variable "features", so in this patch it updates the process of generating the init JS which will be passed back to client side to init the "features" variable(in Class "org.apache.shindig.gadgets.config.CoreUtilConfigContributor"), adds some specific logic to handle "template-library" parameter, convert the relative url to an absolute one. 

 
Review request changed
Updated (April 25, 2012, 2:27 a.m.)
Posted (April 25, 2012, 5:35 p.m.)
Need time to review the flow but would be nice to add test gadget you use to validate the fix.
Posted (April 25, 2012, 8:48 p.m.)

   

  
This seems the wrong approach for me. Each ConfigContributor responsible to add additional config from server.

In this case the CoreUtilConfigContributor is used to add additional logic to push config to init function in the core.util feature.

Not sure how the opensocial-templates JS code could read this new rewritten requireLibrary param.
Ship it!
Posted (April 26, 2012, 6:28 a.m.)
+1 LGTM
Looks like I  was wrong. The core.util provides API to get the param for each feature.

In this case opensocial-templates feature will call gadgets.util.getFeatureParameters(opensocial-templates') to get the requireLibrary param and its been fixed by the server code.
Posted (April 26, 2012, 6:29 a.m.)
Actually could you also add the gadget.xml you used for testing this?
  1. The way I tested it was changing a gadget to use relative url and check the library template request value in the request via firebug, so I can avoid writing a template library file:) 
    Sure, I will write a test gadget&template library file. 
    Thanks.