diff Lib/IMPL/Web/Handler/RestController.pm @ 256:32aceba4ee6d

corrected ViewHandlers to handle cookies and headers. Dirty hacks to handle binary data RestController doesn't deal with file extensions anymore.
author sergey
date Wed, 12 Dec 2012 04:29:50 +0400
parents 827cf96faa1c
children 4abda21186cd
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/RestController.pm	Fri Dec 07 16:58:19 2012 +0400
+++ b/Lib/IMPL/Web/Handler/RestController.pm	Wed Dec 12 04:29:50 2012 +0400
@@ -42,13 +42,6 @@
         
         # remove first segment if it is empty
         shift @segments if @segments && length($segments[0]) == 0;
-        
-        if(@segments) {
-        	my $segment = pop(@segments);
-            my ($obj,$view) = ($segment =~ m/(.*?)(?:\.(\w+))?$/);
-            push @segments, { id => $obj, name => $segment, ext => $view };
-        }
-    
     }
     
     return @segments;    
@@ -64,14 +57,13 @@
 	
 	my $res = $this->resourceFactory->new(
 	   id => 'root',
-	   name => '',
 	   location => Locator->new(base => $action->application->baseUrl)
 	);
 	
 	while(@segments) {
-		my $info = shift @segments;
+		my $id = shift @segments;
 		
-		$res = $res->FetchChildResource($info->{id});
+		$res = $res->FetchChildResource($id);
 	}
 	
 	$res = $res->InvokeHttpVerb($method,$action);
@@ -119,12 +111,18 @@
 Для чего используется метод
 C<< IMPL::Web::Application::ResourceInterface->FetchChildResource($childId) >>.
 
+=begin text
+
+/music/audio.mp3 -> ['music','audio.mp3']
+
+=end text
+
 =head1 MEMEBERS
 
-=head2 C<[get]rootResource>
+=head2 C<[get]resourceFactory>
 
-Корневой ресурс приложения, должен быть всегда и реализовывать интерфес ресурса
-C<IMPL::Web::Application::ResourceInterface>.
+Фабрика для создания корневого ресурса приложения, полученный ресурс должен
+реализовывать интерфейс C<IMPL::Web::Application::ResourceInterface>.
 
 =head2 C<[get]trailingSlash>