[Nitro] Fwd: Nitro + JSONORB

George Moschovitis george.moschovitis at gmail.com
Thu Mar 24 08:11:45 EST 2005


forwarded to the list with permision

---------- Forwarded message ----------
From: James Britt <james_b at neurogami.com>
Date: Wed, 23 Mar 2005 09:19:44 -0700
Subject: Re: Nitro + JSONORB
To: George Moschovitis <george.moschovitis at gmail.com>


George Moschovitis wrote:
> Hmm,
>
> I dont like to have a separate controller just for JSON (or REST,XMLRPC etc).
> I would like to use a single controller (have a look at the blog
> example, how this handles the rdfs). But perhaps I am wrong.

The reasons for a predefined controller is that the end-point for *-RPC
tends to be fixed.  For example, if I expose map.city_list,
map.country_list, and football.team_names as services, all requests from
the client would go to the same end-point (typically something like
http://www.foo.com/RPC)

All the details for what object, method, and arguments are bundled up in
the POST data instead of being exposed in a GET request.

That's one difference between JSON-RPC and the typical AJAX
implementation.  AJAX tends (I think) to function more for side-effect
free data fetches, using GETs to varying end-points.

What may be handy, though, and what I think people will expect, is a way
to create controllers that are automatically configured as RPC services.

So that one could do

class Map < N::JSON_RPC
   def city_list
     # ...
   end
end

and have it available via json-rpc, as map.city_list, at the default
endpoint.  If the developer wants a different endpoint (or possibly more
than one) perhaps these can be set up as routes or something.

and of course people can register arbitrary classes using the current
Orbjson config method (though I tend to think the use of controllers to
wrap the actual service classes seems nicer).

James

>
> -g.
>

--

http://www.ruby-doc.org
http://www.rubyxml.com
http://catapult.rubyforge.com
http://orbjson.rubyforge.com
http://ooo4r.rubyforge.com
http://www.jamesbritt.com


-- 
http://nitro.rubyforge.org
http://www.joy.gr



More information about the Nitro-general mailing list