comparison Lib/IMPL/Web/Handler/RestController.pm @ 202:5146e17a7b76

IMPL::Web::Application::RestResource fixes, documentation
author sergey
date Wed, 25 Apr 2012 02:49:23 +0400
parents e743a8481327
children c8fe3f84feba
comparison
equal deleted inserted replaced
201:0c018a247c8a 202:5146e17a7b76
45 45
46 # remove first segment since it's always empty 46 # remove first segment since it's always empty
47 shift @segments; 47 shift @segments;
48 48
49 my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/); 49 my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/);
50 push @segments, $obj;
50 51
51 if ($this->types and my $type = $this->types->{$view}) { 52 if ($this->types and my $type = $this->types->{$view}) {
52 $action->response->contentType($type); 53 $action->response->contentType($type);
53 } 54 }
54 55
55 my $res = $this->contract->Transform($this->root, { id => '' } ); 56 my $res = $this->contract->Transform($this->root, { id => '' } );
56 57
57 while(@segments) { 58 while(@segments) {
58 my $id = shift @segments; 59 my $id = shift @segments;
59 $res = $this->contract->Transform( $res->InvokeHttpMethod('GET',$id,$action), { parent => $res, id => $id } ); 60
61 $res = $res->FetchChildResource($id,$action);
60 62
61 die NotFoundException->new() unless $res; 63 die NotFoundException->new() unless $res;
62 } 64 }
63 65
64 $res = $res->InvokeHttpMethod($method,$obj,$action); 66 $res = $res->InvokeHttpMethod($method,$action);
65 } 67 }
66 68
67 1; 69 1;
68 70
69 __END__ 71 __END__