Hi all,
I was trying to create a sample Handler in Shindig. It has a list of
methods. Below is the signature of each of the method.
@Operation(httpMethods = "PUT")
public Future<?> update(RequestItem request) throws
ProtocolException {
return processMessage(request);
}
@Operation(httpMethods = "GET")
public Future<?> processGetRequest(RequestItem request) throws
ProtocolException {
return processMessage(request);
}
@Operation(httpMethods = "POST")
public Future<?> processMessage(RequestItem request) throws
ProtocolException {
String title = request.getParameter("title");
String hostname = request.getParameter("hostName");
String eventType = request.getParameter("eventType");
// rest of the code
}
Now I added a new feature which has a js file called event.js which has
a method Namespace.updateEvent for updating the event as follows
Namespace.updateEvent = function(opts,opts_callback) {
Namespace.sendRequestToServer('update', 'POST',
opts,opts_callback,true);
}
Namespace.sendPostRequestToServer = function(url, method,
opt_postParams, opt_callback, opt_excludeSecurityToken) {
var opt_postParams = opt_postParams || {};
var makeRequestParams = {
"CONTENT_TYPE" : "JSON",
"METHOD" : method,
"POST_DATA" : opt_postParams};
if (opt_excludeSecurityToken) {
var secureToken =
escape(Namespace.generateSecureToken());
url = socialpath+ url + "?st=" + secureToken;
}
gadgets.io.makeNonProxiedRequest(url,
function(data) {
data =
data.data;
if
(opt_callback) {
opt_callback(data);
}
},
makeRequestParams,
"application/json"
);
}
Now I call Names.updateEvent() from a gadget by passing the parameters
as follows
Namespace.event.updateEvent(gadgets.io.encodeValues({"title":eventId,"ho
stname":name,...}),callbackmethod);
I found that this call is reaching my handler class and the method
processMessage()is getting called.
But all the parameter values are coming as null. If I change the method
as GET instead of POST, it is working fine. I could not resolve this
issue.
It would be great if somebody can help me in resolving this issue.
Thanks in Advance
Vinu
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