diff Lib/IMPL/Web/Handler/RestController.pm @ 208:3d433a977e3b

corrected RestController for empty PAT_INFO corrected charset for ErrorHandler
author sergey
date Fri, 18 May 2012 18:43:00 +0400
parents c8fe3f84feba
children 292226770180
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/RestController.pm	Fri May 04 02:09:13 2012 +0400
+++ b/Lib/IMPL/Web/Handler/RestController.pm	Fri May 18 18:43:00 2012 +0400
@@ -39,14 +39,20 @@
 	
 	#TODO: path_info is broken for IIS
 	my $pathInfo = $query->path_info;
+	my @segments;
 	
-	my @segments = split /\//, $pathInfo, -1; # keep trailing empty string if present
+	if (length $pathInfo) {
 	
-	# remove first segment since it's always empty
-	shift @segments;
+		@segments = split /\//, $pathInfo, -1; # keep trailing empty string if present
+		
+		# remove first segment since it's always empty
+		shift @segments;
+		
+		my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/);
+		push @segments, $obj;
 	
-	my ($obj,$view) = (pop(@segments) =~ m/(.*?)(?:\.(\w+))?$/);
-	push @segments, $obj;
+	}
+	
 	
 	my $res = $this->contract->Transform($this->root, { id => '' } );