diff Lib/IMPL/Web/Handler/RestController.pm @ 401:16ff604298c7

minor fixes
author cin
date Thu, 15 May 2014 18:24:28 +0400
parents 71221d79e6b4
children
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/RestController.pm	Wed May 14 17:27:32 2014 +0400
+++ b/Lib/IMPL/Web/Handler/RestController.pm	Thu May 15 18:24:28 2014 +0400
@@ -8,7 +8,8 @@
 	    ResourceInterface => 'IMPL::Web::Application::ResourceInterface', 
 		Exception => 'IMPL::Exception',
 		ArgumentExecption => '-IMPL::InvalidArgumentException',
-		NotFoundException => 'IMPL::Web::NotFoundException'
+		NotFoundException => 'IMPL::Web::NotFoundException',
+		Loader => 'IMPL::Code::Loader'
 	},
 	base => {
 		'IMPL::Object' => undef,
@@ -55,7 +56,12 @@
 	
 	my @segments = $this->GetResourcePath($request);
 	
-	my $res = $this->resourceFactory->new(
+	my $factory = $this->resourceFactory;
+	
+	$factory = Loader->default->Require($factory)
+		unless ref($factory) || eval { $factory->can('new') };
+	
+	my $res = $factory->new(
 	   id => 'root',
 	   request => $request,
 	   location => Locator->new(base => $request->application->baseUrl),