comparison Lib/IMPL/Web/Application/Action.pm @ 65:2840c4c85db8

Application configuration improvements Documentation
author wizard
date Tue, 16 Mar 2010 17:36:13 +0300
parents 76b878ad6596
children 9f5795a10939
comparison
equal deleted inserted replaced
64:259cd3df6e53 65:2840c4c85db8
9 9
10 BEGIN { 10 BEGIN {
11 public property application => prop_get | owner_set; 11 public property application => prop_get | owner_set;
12 public property query => prop_get | owner_set; 12 public property query => prop_get | owner_set;
13 public property response => prop_get | owner_set; 13 public property response => prop_get | owner_set;
14 public property responseFactory => prop_get | owner_set;
14 15
15 private property _entryPoint => prop_all; 16 private property _entryPoint => prop_all;
16 } 17 }
17 18
18 #todo: make ability to discard old and create new response 19 sub CTOR {
20 my ($this) = @_;
21
22 $this->responseFactory('IMPL::Web::Application::Response') unless $this->responseFactory;
23 $this->response( $this->responseFactory->new(query => $this->query) );
24 }
19 25
20 sub Invoke { 26 sub Invoke {
21 my ($this) = @_; 27 my ($this) = @_;
22 28
23 if ($this->_entryPoint) { 29 if ($this->_entryPoint) {
24 $this->_entryPoint->(); 30 $this->_entryPoint->();
25 } else { 31 } else {
26 die new IMPL::InvalidOperationException("At least one handler is required"); 32 die new IMPL::InvalidOperationException("At least one handler is required");
27 } 33 }
34 }
35
36 sub ReinitResponse {
37 my ($this) = @_;
38
39 die new IMPL::InvalidOperationException("Response already sent") if $this->response->isHeaderPrinted;
40
41 $this->response->Discard;
42 $this->response($this->responseFactory->new(query => $this->query));
28 } 43 }
29 44
30 sub ChainHandler { 45 sub ChainHandler {
31 my ($this,$handler) = @_; 46 my ($this,$handler) = @_;
32 47