Mercurial > pub > Impl
comparison Lib/IMPL/Web/Handler/RestController.pm @ 255:827cf96faa1c
refactoring (incomplete)
| author | sergey |
|---|---|
| date | Fri, 07 Dec 2012 16:58:19 +0400 |
| parents | a02b110da931 |
| children | 32aceba4ee6d |
comparison
equal
deleted
inserted
replaced
| 254:fb52014f6931 | 255:827cf96faa1c |
|---|---|
| 42 | 42 |
| 43 # remove first segment if it is empty | 43 # remove first segment if it is empty |
| 44 shift @segments if @segments && length($segments[0]) == 0; | 44 shift @segments if @segments && length($segments[0]) == 0; |
| 45 | 45 |
| 46 if(@segments) { | 46 if(@segments) { |
| 47 my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/); | 47 my $segment = pop(@segments); |
| 48 push @segments, $obj; | 48 my ($obj,$view) = ($segment =~ m/(.*?)(?:\.(\w+))?$/); |
| 49 push @segments, { id => $obj, name => $segment, ext => $view }; | |
| 49 } | 50 } |
| 50 | 51 |
| 51 } | 52 } |
| 52 | 53 |
| 53 return @segments; | 54 return @segments; |
| 61 | 62 |
| 62 my @segments = $this->GetResourcePath($action); | 63 my @segments = $this->GetResourcePath($action); |
| 63 | 64 |
| 64 my $res = $this->resourceFactory->new( | 65 my $res = $this->resourceFactory->new( |
| 65 id => 'root', | 66 id => 'root', |
| 67 name => '', | |
| 66 location => Locator->new(base => $action->application->baseUrl) | 68 location => Locator->new(base => $action->application->baseUrl) |
| 67 ); | 69 ); |
| 68 | 70 |
| 69 while(@segments) { | 71 while(@segments) { |
| 70 my $id = shift @segments; | 72 my $info = shift @segments; |
| 71 | 73 |
| 72 $res = $res->FetchChildResource($id); | 74 $res = $res->FetchChildResource($info->{id}); |
| 73 } | 75 } |
| 74 | 76 |
| 75 $res = $res->InvokeHttpVerb($method,$action); | 77 $res = $res->InvokeHttpVerb($method,$action); |
| 76 } | 78 } |
| 77 | 79 |
