diff Lib/IMPL/Web/Handler/TTView.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 a02b110da931
children 89179bb8c388
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/TTView.pm	Fri Dec 07 16:58:19 2012 +0400
+++ b/Lib/IMPL/Web/Handler/TTView.pm	Wed Dec 12 04:29:50 2012 +0400
@@ -65,14 +65,24 @@
     };
 
     my $doc =
-      $this->loader->document( $this->SelectView( $action, ref $model ),
+      $this->loader->document( eval { $view->template } || $this->SelectView( $action, ref $model ),
         $vars );
-
-    return HttpResponse->new(
+        
+    $doc->location($view->location);
+        
+    my %responseParams = (
         type => $this->contentType,
         charset => $this->contentCharset,
         body => $doc->Render()
     );
+    
+    $responseParams{status} = $view->status if $view->status;
+    $responseParams{cookies} = $view->cookies if ref $view->cookies eq 'HASH';
+    $responseParams{headers} = $view->headers if ref $view->headers eq 'HASH';
+
+    return HttpResponse->new(
+        %responseParams        
+    );
 }
 
 sub SelectView {