comparison Lib/IMPL/Web/Application.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
14 14
15 BEGIN { 15 BEGIN {
16 public property handlerError => prop_all; 16 public property handlerError => prop_all;
17 public property factoryAction => prop_all; 17 public property factoryAction => prop_all;
18 public property handlersQuery => prop_all | prop_list; 18 public property handlersQuery => prop_all | prop_list;
19 public property responseCharset => prop_all;
19 public property options => prop_all; 20 public property options => prop_all;
20 } 21 }
21 22
22 # custom factory 23 # custom factory
23 sub new { 24 sub new {
28 29
29 sub CTOR { 30 sub CTOR {
30 my ($this) = @_; 31 my ($this) = @_;
31 32
32 $this->factoryAction('IMPL::Web::Application::Action') unless $this->factoryAction; 33 $this->factoryAction('IMPL::Web::Application::Action') unless $this->factoryAction;
34 $this->responseCharset('utf-8') unless $this->responseCharset;
33 } 35 }
34 36
35 sub Run { 37 sub Run {
36 my ($this) = @_; 38 my ($this) = @_;
37 39
38 while (my $query = $this->FetchRequest()) { 40 while (my $query = $this->FetchRequest()) {
39 41
40 # todo: move a creation of the response to the ActionClass
41 my $action = $this->factoryAction->new( 42 my $action = $this->factoryAction->new(
42 query => $query, 43 query => $query,
43 response => new IMPL::Web::Application::Response(query => $query),
44 application => $this, 44 application => $this,
45 ); 45 );
46
47 $action->response->charset($this->responseCharset);
46 48
47 $action->ChainHandler($_) foreach $this->handlersQuery; 49 $action->ChainHandler($_) foreach $this->handlersQuery;
48 50
49 $action->Invoke(); 51 $action->Invoke();
50 52