Mercurial > pub > Impl
diff Lib/IMPL/Web/Handler/RestController.pm @ 244:a02b110da931
refactoring
fixed binding to CGI query parameters with multiple values
author | sergey |
---|---|
date | Mon, 22 Oct 2012 04:09:27 +0400 |
parents | 3cebcf6fdb9b |
children | 827cf96faa1c |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/RestController.pm Fri Oct 19 02:23:15 2012 +0400 +++ b/Lib/IMPL/Web/Handler/RestController.pm Mon Oct 22 04:09:27 2012 +0400 @@ -4,6 +4,7 @@ use IMPL::Const qw(:prop); use IMPL::declare { require => { + Locator => 'IMPL::Web::AutoLocator', ResourceInterface => 'IMPL::Web::Application::ResourceInterface', Exception => 'IMPL::Exception', ArgumentExecption => '-IMPL::InvalidArgumentException', @@ -15,7 +16,7 @@ 'IMPL::Object::Serializable' => undef }, props => [ - rootResource => PROP_RO, + resourceFactory => PROP_RO, trailingSlash => PROP_RO ] }; @@ -23,8 +24,9 @@ sub CTOR { my ($this) = @_; - die ArgumentException->new(rootResource => "A web-resource is required") - unless eval { $this->rootResource->isa(ResourceInterface) }; + die ArgumentException->new(resourceFactory => "A web-resource is required") + unless $this->resourceFactory; + #unless eval { $this->resourceFacotry->isa(ResourceInterface) }; } @@ -59,7 +61,10 @@ my @segments = $this->GetResourcePath($action); - my $res = $this->rootResource; + my $res = $this->resourceFactory->new( + id => 'root', + location => Locator->new(base => $action->application->baseUrl) + ); while(@segments) { my $id = shift @segments;