[Catalyst] Catalyst::*::REST and Javascript
Mark Trostler
mark at zzo.com
Tue Aug 12 23:20:59 BST 2008
Ya I agree that doc is a little wacky - I tend to craft my own urls &
set the HTTP method appropriately - I stick the JSON-encoded data in a
'data' request parameter & have my auto sub in my Root controller peel
it off of there & put it in $c->data so it all looks the same after that.
like:
if (my $data = $c->stash->{raw_params}->{data}) {
$c->req->data(decode_json($data));
}
Mark
Robert Krimen wrote:
>
> On Mon, Aug 11, 2008 at 9:57 PM, Mark Trostler <mark at zzo.com
> <mailto:mark at zzo.com>> wrote:
>
> I've had good luck with ExtJS:
>
> http://extjs.com/learn/Manual:RESTful_Web_Services
>
> Mark
>
>
> Wikipedia demonstrates REST like:
>
> userResource = new Resource('http://example.com/users/001')
> userResource.delete()
>
> Whereas ExtJS seems to be of form:
>
> userResource = new Resource('http://example.com/users?id=001')
>
> The difference being that REST-proper encapsulates the id of the user in the
> URI path, where as ExtJS includes it as a query parameter.
>
> I like the former technique because it dovetails with Catalyst's
> chaining paradigm nicely.
>
> Looks like best practice for now is to craft URIs manually and feed them
> into your YUI, jQuery, or
> ExtJS AJAX routine of choice.
>
> Rob
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
More information about the Catalyst
mailing list