Shindig is configured, by default, to be accessed in ROOT context. While this is ok for development purposes, it is not desirable in a production setting where main applications may already be running in ROOT context OR in cases where a web server acts as a HTTP Reverse Proxy for an Appserver.
This post describes the steps I followed to make Shindig gadget and opensocial containers work on my Tomcat Server in a non-Root Context. Thanks a ton to Kevin Brown for providing valuable pointers in this email chain.
The following steps would enable deployment of Shindig in a non Root context on Tomcat and other AppServers.
1) Build shindig using steps provided at http://incubator.apache.org/shindig/#tab-building
2) Copy shindig/java/server/target/shindig-server-1.1-SNAPSHOT.war to a temporary folder (say c:\temp)
3) cd c:\temp
4) unzip shindig-server-1.1-SNAPSHOT.war to c:\temp\shindig folder
5) cd shindig/WEB-INF/classes/containers/default
6) Open container.js in a text editor. Since the default setting assumes shindig to be in the root context, it is necessary to modify all URLs for opensocial calls to work correctly. After updating all URLs, save changes and close container.js.
(There are some properties in shindig still that are pending migration to container.js, hence step#7 to 10. Thanks Carmen and Gerald for this suggestion)
7) Extract shindig.properties from shindig/WEB-INF/lib/shindig-common-1.1-SNAPSHOT.jar to shindig/WEB-INF/classes folder
8) Remove shindig.properties from shindig/WEB-INF/lib/shindig-common-1.1-SNAPSHOT.jar
9) cd shindig/WEB-INF/classes
10) Open shindig.properties in a text editor. Since the default setting assumes shindig to be in the root context, it is necessary to modify all URLs for gadget/concat calls to work correctly.
11) Fix Shindig's sample opensocial container "samplecontainer"
(a) cd c:/temp/shindig/gadgets/files/samplecontainer
(b) Open samplecontainer.js in a text editor
(c) Append Shindig's context name in the URL assigned to the variable "socialDataPath" (line# 44)
(d) Append Shindig's context name in the URI passed to sendRequestToServer() within requestGadgetMetaData function (line# 192)
(e) save & close samplecontainer.js
(f) cd examples
(g) Open all gadget xmls and, update URL of images (for ex:- bubble.gif, nophoto.if etc.)
(h) Also, make the changes mentioned in steps b-g for samplecontainer provided under c:/temp/shindig/WEB-INF/classes/gadgets/files/samplecontainer
12) Zip the contents of shindig folder and rename the zip file as shindig.war or any other name based on your preference.
13) This war file would now work on Tomcat or any other app server in a non-root context
Subscribe to:
Post Comments (Atom)
2 comments:
As I mentioned in the email thread referenced above, if you're able to set up URL rewriting and if you don't have any contexts named "social" or "gadgets", then the only change required is to set up a rewrite rule to map /social and /gadgets to /shindig/social and /shindig/gadgets. No other changes are required (detail).
That's not enough to shindig 2.0.0, BaseIfrGadget use a serverBase propertie to append a "metadata?" string and create the URL to download gadgets.
So I did your steps, and also changed the gadgetClass behavior.
[code]
widget.WidgetIfrGadget = function(opt_params) {
shindig.Gadget.call(this, opt_params);
this.serverBase_ = '/shindig/gadgets/'; // default gadget server
this.queryIfrGadgetType_();
};
widget.WidgetIfrGadget.inherits(shindig.BaseIfrGadget);
[code]
And changed the gadget class with:
[code]
shindig.IfrContainer.prototype.gadgetClass = widget.WidgetIfrGadget;
[/code]
Maxwell
Post a Comment