Don't forget to check out Catalyst::Controller::REST, especially if you're
just going to be using a plugin.

On Tue, Apr 14, 2009 at 1:14 PM, James R. Leu <[email protected]> wrote:

> I know is it not recommended, but I use C::P::JSONRPC (with Dojo).
>
> In my Root controller I do:
>
> sub jsonapi : Local {
>    my($self, $c) = @_;
>    $c->json_rpc;
> }
>
> sub getEventsSummary : Remote {
>    my($class, $c, $el) = @_;
> }
>
> My SMD looks like:
>
> {
>    "SMDVersion":"1.9",
>    "serviceType":"JSON-RPC",
>    "serviceURL":"/jsonapi",
>    "methods":[
>        {
>            "name":"getEventsSummary",
>            "parameters":[
>                { "name":"entityLocator" }
>            ]
>        }
>    ]
> }
>
> Then in the client I do:
>
>    var url = "[% Catalyst.uri_for('/static/jsonapi.smd') %]";
>    var rpc = new dojo.rpc.JsonService(url);
>    var call = rpc.getEventsSummary('north42');
>    call.addCallback(...);
>    call.addErrback(...);
>
> On Tue, Apr 14, 2009 at 06:05:53PM +0300, Octavian Râşniţă wrote:
> > Hi,
> >
> > What's the recommended module for getting a JSON request and creating a
> > JSON response in a Catalyst app?
> > (I want to use them with JQuery.)
> >
> > Thanks.
> >
> > Octavian
> >
> >
> > _______________________________________________
> > List: [email protected]
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive:
> http://www.mail-archive.com/[email protected]/
> > Dev site: http://dev.catalyst.perl.org/
>
> --
> James R. Leu
> [email protected]
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
>


-- 
Devin Austin
http://www.codedright.net
http://www.dreamhost.com/r.cgi?326568/hosting.html - Host with DreamHost!
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to