Hi,
I am trying to add new feature to shindig for that I am trying to make
handlers for providing additional functionality as socialsite does. I am
getting an response error as sampledef not implemented. I am adding code
snippet below . Can anyone suggest me is there any additional
configuration I need to get my handler working. Am I going wrong
somewhere?.
Feature (JS file)
var samplesocial = samplesocial || {};
samplesocial .sampleMessage = function(name) {
var rpc = { method : "sampledef.get" };
rpc.params = {"name" : name};
return new JsonRpcRequestItem(rpc,
function (rawJson) {
return rawJson;
});
}
Handler Code
@Service(name = "sampledef")
public class SampleHandler {
@Operation(httpMethods="GET")
public Future create(String name) throws SocialSpiException,
JSONException{
JSONObject ret = null;
System.out.println("Handler getting called"+name);
ret = new JSONObject();
ret.put("code", 200).put("message", "Successful");
return ImmediateFuture.newInstance(ret);
}
}
Gadget code from where i am making call
function initData() {
var req = opensocial.newDataRequest();
req.add(samplesocial .sampleMessage("Hi"));
req.send(display);
}
function display(data) {
alert("data: "+data.getData);
}
gadgets.util.registerOnLoadHandler(initData);
Error
org.apache.shindig.protocol.ProtocolException: The
method sampledef.get is not implemented
at
org.apache.shindig.protocol.DefaultHandlerRegistry.getRpcHandler(Default
HandlerRegistry.java:96)
at
org.apache.shindig.protocol.JsonRpcServlet.getHandler(JsonRpcServlet.jav
a:190)
at
org.apache.shindig.protocol.JsonRpcServlet.dispatchBatch(JsonRpcServlet.
java:148)
at
org.apache.shindig.protocol.JsonRpcServlet.doPost(JsonRpcServlet.java:12
6)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
.................
..............
Regards,
Pinky Muralidhar.
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com