comparison 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
comparison
equal deleted inserted replaced
255:827cf96faa1c 256:32aceba4ee6d
63 return Factory->new($class); 63 return Factory->new($class);
64 } 64 }
65 }; 65 };
66 66
67 my $doc = 67 my $doc =
68 $this->loader->document( $this->SelectView( $action, ref $model ), 68 $this->loader->document( eval { $view->template } || $this->SelectView( $action, ref $model ),
69 $vars ); 69 $vars );
70 70
71 return HttpResponse->new( 71 $doc->location($view->location);
72
73 my %responseParams = (
72 type => $this->contentType, 74 type => $this->contentType,
73 charset => $this->contentCharset, 75 charset => $this->contentCharset,
74 body => $doc->Render() 76 body => $doc->Render()
77 );
78
79 $responseParams{status} = $view->status if $view->status;
80 $responseParams{cookies} = $view->cookies if ref $view->cookies eq 'HASH';
81 $responseParams{headers} = $view->headers if ref $view->headers eq 'HASH';
82
83 return HttpResponse->new(
84 %responseParams
75 ); 85 );
76 } 86 }
77 87
78 sub SelectView { 88 sub SelectView {
79 my ( $this, $action, $class ) = @_; 89 my ( $this, $action, $class ) = @_;