|
Rewrite of osapi to factor out the RPC transport mechanism and support a gadgets.rpc based transport in addition to the json-rpc one. This is a pretty extensive rewrite but hopefully the code is a little simpler and more extensible now. It should be fairly trivial to add a REST transport instead of the json-rpc one for instance.
There is now a container-side osapi.js which container can use as a basis for exposing additional osapi services using the new gadgets.rpc transport. See /javascript/container/osapi.js.
To enable this feature in your container config you can either have the set of services introspected at gadget render-time using
{ "gadget.features" ...
{ "osapi.services" :
{"gadgets.rpc" : ["container.listMethods"]}
}
}
or if you want to avoid introspection and just list out the container methods to expose and exclude "container.listMethods". E.g.
{ "gadget.features" ...
{ "osapi.services" :
{"gadgets.rpc" :
["requestShareApp", "requestPermission"]}
}
}
In your container JS to add new methods simply bind them to the osapi namespace. E.g.
osapi.newservice = {};
osapi.newservice.do = function (request, callback) {
callback(<data>);
}
will expose osapi.newservice.do inside any gadget on the page if introspection is enabled, if introspection is disabled it needs to be added to the container config.
The samplecontainer is updated to support introspection
In addition the container config now supports declaring the set of available methods for a json-rpc endpoint directly too so that Shindig doesnt have to call system.listMethods against each endpoint. Instead you can directly add
{ "gadget.features" ...
{ "osapi.services" :
{"http://%host%/social/rpc" :
["people.get", "activities.get", ...]}
}
}
Other minor changes..
- makeNonProxiedRequest now returns error "rc" and "text" fields
- osapi introspection over gadgets.rpc can delay the gadget onload callback by a max of 300ms.
- osapi.ui is removed. The sample container exposes "activities.requestCreate", "messages.requestSend", "requestShareApp", "requestPermission" as examples only. This is subject to change as these are not standardized
- osapi batching supports request chaining. If the response to an osapi api call is a JSON-RPC method call, it is executed and made available under the original key
Thanks to Sachin Senoy for his initial work on the gadgets.rpc transport.
Total comments: 34
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+976 lines, -1411 lines) |
Patch |
 |
|
../trunk/config/container.js
|
View
|
1
|
1 chunk |
+10 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/features/bin/runner.sh
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
|
../trunk/features/pom.xml
|
View
|
1
|
1 chunk |
+3 lines, -3 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/core.io/io.js
|
View
|
1
|
1 chunk |
+10 lines, -2 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/features.txt
|
View
|
1
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi.ui/feature.xml
|
View
|
1
|
1 chunk |
+0 lines, -27 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi.ui/ui.js
|
View
|
1
|
1 chunk |
+0 lines, -212 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/batch.js
|
View
|
1
|
2 chunks |
+95 lines, -167 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/feature.xml
|
View
|
1
|
1 chunk |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/gadgetsrpctransport.js
|
View
|
1
|
1 chunk |
+115 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/jsonrequest.js
|
View
|
1
|
1 chunk |
+0 lines, -197 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/jsonrpctransport.js
|
View
|
1
|
1 chunk |
+92 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/osapi.js
|
View
|
1
|
1 chunk |
+47 lines, -29 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/peoplehelpers.js
|
View
|
1
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
 |
|
../trunk/features/src/main/javascript/features/osapi/util.js
|
View
|
1
|
1 chunk |
+0 lines, -59 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/alltests.js
|
View
|
1
|
3 chunks |
+5 lines, -9 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/activitiestest.js
|
View
|
1
|
1 chunk |
+0 lines, -234 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/appdatatest.js
|
View
|
1
|
1 chunk |
+0 lines, -190 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/batchtest.js
|
View
|
1
|
5 chunks |
+12 lines, -15 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js
|
View
|
|
1 chunk |
+422 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/osapitest.js
|
View
|
1
|
1 chunk |
+19 lines, -61 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/features/osapi/peopletest.js
|
View
|
1
|
1 chunk |
+0 lines, -189 lines |
0 comments
|
Download
|
 |
|
../trunk/features/src/test/javascript/lib/testutils.js
|
View
|
1
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/DefaultServiceFetcher.java
|
View
|
1
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java
|
View
|
1
|
2 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
|
../trunk/javascript/container/osapi.js
|
View
|
1
|
1 chunk |
+110 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
|
View
|
1
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
|
../trunk/javascript/samplecontainer/samplecontainer.html
|
View
|
1
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/javascript/samplecontainer/samplecontainer.js
|
View
|
1
|
1 chunk |
+16 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/site/src/site/xdoc/developers/features/index.xml
|
View
|
|
1 chunk |
+0 lines, -4 lines |
0 comments
|
Download
|
Total messages: 6
|