# HG changeset patch # User cin # Date 1400074052 -14400 # Node ID ef37ec102dab7ae7a05e4fd35b2ef9756a491552 # Parent 753e981782ce1d00a85254c9ffafc3ec79641f55 redirection support while fetching child resources diff -r 753e981782ce -r ef37ec102dab Lib/IMPL/Web/Application/HttpResponseResource.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/IMPL/Web/Application/HttpResponseResource.pm Wed May 14 17:27:32 2014 +0400 @@ -0,0 +1,32 @@ +package IMPL::Web::Application::HttpResponseResource; +use strict; + +use IMPL::Const qw(:prop); +use IMPL::declare { + require => { + HttpResponse => 'IMPL::Web::HttpResponse' + }, + base => [ + 'IMPL::Object' => undef, + 'IMPL::Web::Application::ResourceInterface' => undef + ], + props => [ + response => PROP_RW + ] +}; + +sub CTOR { + my ($this,%args) = @_; + + $this->response($args{response} || HttpResponse->NoContent); +} + +sub FetchChildResource { + return shift; +} + +sub InvokeHttpVerb { + return shift->response; +} + +1; \ No newline at end of file diff -r 753e981782ce -r ef37ec102dab Lib/IMPL/Web/Application/Resource.pm --- a/Lib/IMPL/Web/Application/Resource.pm Mon May 12 18:04:40 2014 +0400 +++ b/Lib/IMPL/Web/Application/Resource.pm Wed May 14 17:27:32 2014 +0400 @@ -14,10 +14,11 @@ OpException => '-IMPL::InvalidOperationException', NotFoundException => 'IMPL::Web::NotFoundException', ResourceInterface => '-IMPL::Web::Application', + HttpResponse => 'IMPL::Web::HttpResponse', + HttpResponseResource => 'IMPL::Web::Application::HttpResponseResource', Loader => 'IMPL::Code::Loader' }, base => [ - 'IMPL::Object' => undef, 'IMPL::Web::Application::ResourceBase' => '@_' ], props => [ @@ -110,6 +111,12 @@ return $info if (is($info,ResourceInterface)); + + $info = { + response => $info, + class => HttpResponseResource + } + if is($info,HttpResponse); return $this->CreateChildResource($info, $childId) if ref($info) eq 'HASH';