On Wed Jan 21 2015 at 9:37:16 AM halcwb <hal...@gmail.com> wrote:
> So, there is an *id* field, only the field is called *tid*. This is because
> the service was meant to work with ExtJs, and for that framework, the reply
> should be identified by a 'tid' instead of an id (probably the t is for
> transaction). I don't want to change the backend otherwise I bread the
> service for my current ExtJs implementation.
>
Got it. The ExtJs server apparently implements something that claims to be
JSON-RPC, but doesn't follow the JSON-RPC protocol. (The field "id" is not
allowed to be called "tid" in a JSON-RPC request or response.)
So, you have a couple of choices. The easy one for me to suggest (since I'm
not implementing your server) is for your server to copy the tid field in
the response to a new field called id. That way, the response will work for
both ExtJs clients and qooxdoo ones.
If that's not a feasible solution, you can try something like this:
- extend qx.io.remote.Rpc
- override the method createRequest as follows (untested)
createRequest : function()
{
var req = this.base(arguments); // get the request object
// Add a listener to munge the response. Since this listener
// is added before the one in _callInternal, this one should be
// called before the one in _callInternal.
req.addListener(
"completed",
function(evt)
{
// get a reference to the response object
var response = evt.getContent();
// If we got a response...
if (response !== null)
{
// Modify the response object in the event content.
// You may want a conditional here: only overwrite if id
// member does not already exist.
response["id"] = response["tid"];
}
});
// return the request object
return req;
}
Then, of course, use your extended class instead of qx.io.remote.Rpc to
issue your not-quite-JSON-RPC requests.
Do you have a similar issue with the request object? Does the server expect
its identifier to be called tid instead of id as well? If so, then you'll
also want to override the createRpcData method, and use "tid" instead of
"id" in the requestObject which it creates.
Please let me know how this works for you. I suspect it should actually
work.
Cheers,
Derrell
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel