Mercurial > pub > Impl
comparison Lib/IMPL/Web/Handler/JSONView.pm @ 199:e743a8481327
Added REST support for forms (with only get and post methods)
author | sergey |
---|---|
date | Mon, 23 Apr 2012 01:36:52 +0400 |
parents | 2ffe6f661605 |
children | c8fe3f84feba |
comparison
equal
deleted
inserted
replaced
198:2ffe6f661605 | 199:e743a8481327 |
---|---|
15 my ($this,$action,$next) = @_; | 15 my ($this,$action,$next) = @_; |
16 | 16 |
17 my $result = $next->($action); | 17 my $result = $next->($action); |
18 $result = [$result] unless ref $result; | 18 $result = [$result] unless ref $result; |
19 | 19 |
20 $action->response->contentType('text/javascript'); | 20 #$action->response->contentType('text/javascript'); |
21 | 21 |
22 my $hout = $action->response->streamBody; | 22 my $hout = $action->response->streamBody; |
23 | 23 |
24 print $hout JSON->new->utf8->pretty->encode($result); | 24 print $hout JSON->new->utf8->pretty->encode($result); |
25 } | 25 } |