diff Lib/IMPL/Web/Handler/RestController.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 47f77e6409f7
children 3cebcf6fdb9b
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/RestController.pm	Sat Sep 29 02:34:47 2012 +0400
+++ b/Lib/IMPL/Web/Handler/RestController.pm	Mon Oct 08 03:37:37 2012 +0400
@@ -38,11 +38,13 @@
     
         @segments = split(/\//, $pathInfo, $this->trailingSlash ? -1 : 0);
         
-        # remove first segment since it's always empty
-        shift @segments;
+        # remove first segment if it is empty
+        shift @segments if @segments && length($segments[0]) == 0;
         
-        my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/);
-        push @segments, $obj;
+        if(@segments) {
+            my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/);
+            push @segments, $obj;
+        }
     
     }
     
@@ -63,8 +65,6 @@
 		my $id = shift @segments;
 		
 		$res = $res->FetchChildResource($id);
-		
-		die NotFoundException->new($pathInfo,$id) unless $res;
 	}
 	
 	$res = $res->InvokeHttpVerb($method,$action);