annotate Lib/IMPL/Web/Application.pm @ 183:2184fa28b49e

IMPL::Web::View::TTLoader tests
author cin
date Wed, 28 Mar 2012 17:28:51 +0400
parents d1676be8afcc
children 4d0e1962161c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
1 package IMPL::Web::Application;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
4
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 138
diff changeset
5 use parent qw(IMPL::Config IMPL::Object::Singleton);
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
6
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
7 require IMPL::Web::Application::Action;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
8 require IMPL::Web::Application::Response;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
9
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
10 use IMPL::Class::Property;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
11 use CGI;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
12
60
b0c068da93ac Lazy activation for the configuration objects (final concept)
wizard
parents: 59
diff changeset
13 __PACKAGE__->PassThroughArgs;
b0c068da93ac Lazy activation for the configuration objects (final concept)
wizard
parents: 59
diff changeset
14
170
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
15 public property handlerError => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
16 public property actionFactory => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
17 public property handlersQuery => prop_all | prop_list;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
18 public property responseCharset => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
19 public property security => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
20 public property options => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
21 public property fetchRequestMethod => prop_all;
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
22
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
23
62
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
24 sub CTOR {
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
25 my ($this) = @_;
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
26
170
b88b7fe60aa3 refactoring
sourcer
parents: 166
diff changeset
27 $this->actionFactory(typeof IMPL::Web::Application::Action) unless $this->actionFactory;
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
28 $this->responseCharset('utf-8') unless $this->responseCharset;
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
29 $this->fetchRequestMethod(\&defaultFetchRequest) unless $this->fetchRequestMethod;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
30 $this->handlerError(\&defaultHandlerError) unless $this->handlerError;
62
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
31 }
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
32
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
33 sub Run {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
34 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
35
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
36 while (my $query = $this->FetchRequest()) {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
37
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
38 my $action = $this->actionFactory->new(
62
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
39 query => $query,
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
40 application => $this,
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
41 );
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
42
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
43 eval {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
44 $action->response->charset($this->responseCharset);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
45
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
46 $action->ChainHandler($_) foreach $this->handlersQuery;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
47
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
48 $action->Invoke();
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
49
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
50 $action->response->Complete;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
51 };
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
52 if ($@) {
99
6dd659f6f66c Minor changes, DOM schema is in development (in the aspect of a forms)
wizard
parents: 97
diff changeset
53 my $e = $@;
129
e4f15cbc3f1a Fixed utf-8 problem
wizard
parents: 99
diff changeset
54 # we are expecting this method to be safe otherwise we can trust nothing in this wolrd
99
6dd659f6f66c Minor changes, DOM schema is in development (in the aspect of a forms)
wizard
parents: 97
diff changeset
55 $this->handlerError()->($this,$action,$e);
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
56 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
57 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
58 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
59
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
60 sub FetchRequest {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
61 my ($this) = @_;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
62
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
63 if( ref $this->fetchRequestMethod eq 'CODE' ) {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
64 return $this->fetchRequestMethod->($this);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
65 } else {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
66 die new IMPL::Exception("Unknown fetchRequestMethod type",ref $this->fetchRequestMethod);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
67 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
68 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
69
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
70 {
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
71 my $hasFetched = 0;
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
72
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
73 sub defaultFetchRequest {
129
e4f15cbc3f1a Fixed utf-8 problem
wizard
parents: 99
diff changeset
74 my ($this) = @_;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
75 return undef if $hasFetched;
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
76 $hasFetched = 1;
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
77 my $query = CGIWrapper->new();
129
e4f15cbc3f1a Fixed utf-8 problem
wizard
parents: 99
diff changeset
78 $query->charset($this->responseCharset);
e4f15cbc3f1a Fixed utf-8 problem
wizard
parents: 99
diff changeset
79 return $query;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
80 }
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
81 }
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
82
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
83 sub defaultHandlerError {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
84 my ($this,$action,$e) = @_;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
85 warn $e;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
86 if ( eval { $action->ReinitResponse(); 1; } ) {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
87 $action->response->contentType('text/plain');
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
88 $action->response->charset($this->responseCharset);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
89 $action->response->status(500);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
90 my $hout = $action->response->streamBody;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
91 print $hout $e;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
92 $action->response->Complete();
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
93 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
94 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
95
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
96 package CGIWrapper;
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 138
diff changeset
97 use parent qw(CGI);
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
98
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
99 use Encode;
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
100
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
101 our $NO_DECODE = 0;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
102
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
103 sub param {
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
104 my $this = shift;
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
105
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
106 return $this->SUPER::param(@_) if $NO_DECODE;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
107
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
108 if (wantarray) {
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
109 my @result = $this->SUPER::param(@_);
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
110
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
111 return map Encode::is_utf8($_) ? $_ : Encode::decode($this->charset,$_,Encode::LEAVE_SRC), @result;
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
112 } else {
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
113 my $result = $this->SUPER::param(@_);
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
114
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
115 return Encode::is_utf8($result) ? $result : Encode::decode($this->charset,$result,Encode::LEAVE_SRC);
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
116 }
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
117
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
118 }
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
119
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
120 sub upload {
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
121 my $this = shift;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
122
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
123 local $NO_DECODE = 1;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
124 my $oldCharset = $this->charset();
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
125 $this->charset('ISO-8859-1');
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
126
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
127 my $fh = $this->SUPER::upload(@_);
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
128
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
129 $this->charset($oldCharset);
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
130 return $fh;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
131 }
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
132
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
133 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
134
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
135 __END__
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
136
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
137 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
138
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
139 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
140
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
141 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
142
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
143 require MyApp;
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
144
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
145 my $instance = spawn MyApp('app.config');
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
146
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
147 $instance->Run();
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
148
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
149 =end code
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
150
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
151 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
152
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 138
diff changeset
153 C< use parent qw( IMPL::Config IMPL::Object::Singleton )>
73
wizard
parents: 67
diff changeset
154
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
155 Зкземпляр приложения содержит в себе глобальные настройки, реализует контроллер запросов,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
156 в качестве источника запросов используется CGI или иной совместимый модуль.
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
157
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
158 Процесс обработки запроса состоит из следующих частей
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
159
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
160 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
161
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
162 =item 1
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
163
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
164 Получение cgi запроса
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
165
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
166 =item 2
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
167
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
168 Создание объекта C<IMPL::Web::Application::Action>
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
169
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
170 =item 3
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
171
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
172 Формирование цепочки вызовов при помощи C<< IMPL::Web::Application::Action->ChainHandler >>
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
173
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
174 =item 4
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
175
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
176 Выполнение запроса C<< IMPL::Web::Application::Action->Invoke >>
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
177
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
178 =cut
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
179
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
180 Также приложение поддерживает отложенное создание объектов, которые по первому обращению
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
181 к свойствам. Это реализовано в базовом классе C< IMPL::Configuration >. Для настройки
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
182 активаторов можно использовать свойство C<options>, в которое должен быть помещен хеш
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
183 со ссылками на активаторы, см. пример ниже C<CONFIGURATION>.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
184
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
185 =head2 CONFIGURATION
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
186
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
187 Ниже приведен пример конфигурации приложения
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
188
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
189 =begin code xml
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
190
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
191 <?xml version="1.0" encoding="UTF-8"?>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
192 <Application id='app' type="Test::Web::Application::Instance">
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
193
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
194 <!-- Begin custom properties -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
195 <name>Sample application</name>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
196 <dataSource type='IMPL::Config::Activator' id='ds'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
197 <factory>IMPL::Object</factory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
198 <parameters type='HASH'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
199 <db>data</db>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
200 <user>nobody</user>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
201 </parameters>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
202 </dataSource>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
203 <securityMod type='IMPL::Config::Activator'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
204 <factory>IMPL::Object</factory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
205 <parameters type='HASH'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
206 <ds refid='ds'/>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
207 </parameters>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
208 </securityMod>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
209 <!-- End custom properties -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
210
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
211 <!-- direct access to the activators -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
212 <options type="HASH">
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
213 <dataSource refid='ds'/>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
214 </options>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
215
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
216 <!-- Set default output encoding, can be changed due query handling -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
217 <responseCharset>utf-8</responseCharset>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
218
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
219 <!-- Actions creation configuration -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
220 <actionFactory type="IMPL::Object::Factory">
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
221
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
222 <!-- Construct actions -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
223 <factory>IMPL::Web::Application::Action</factory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
224 <parameters type='HASH'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
225
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
226 <!-- with special responseFactory -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
227 <responseFactory type='IMPL::Object::Factory'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
228
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
229 <!-- Where resopnses have a special streamOut -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
230 <factory>IMPL::Web::Application::Response</factory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
231 <parameters type='HASH'>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
232
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
233 <!-- in memory dummy output instead of STDOUT -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
234 <streamOut>memory</streamOut>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
235
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
236 </parameters>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
237 </responseFactory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
238 </parameters>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
239 </actionFactory>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
240
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
241 <!-- Query processing chain -->
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
242 <handlersQuery type="IMPL::Object::List">
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
243 <item type="IMPL::Web::QueryHandler::PageFormat">
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
244 <templatesCharset>cp1251</templatesCharset>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
245 </item>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
246 </handlersQuery>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
247 </Application>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
248
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
249 =end code xml
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
250
73
wizard
parents: 67
diff changeset
251 =head1 MEMBERS
wizard
parents: 67
diff changeset
252
wizard
parents: 67
diff changeset
253 =over
wizard
parents: 67
diff changeset
254
wizard
parents: 67
diff changeset
255 =item C<[get,set] handlerError>
wizard
parents: 67
diff changeset
256
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
257 Обработчик который будет вызван в случае возникновения необработанной ошибки
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
258 в процессе работы приложения. После чего приложение корректно завершается.
73
wizard
parents: 67
diff changeset
259
wizard
parents: 67
diff changeset
260 =item C<[get,set] actionFactory>
wizard
parents: 67
diff changeset
261
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
262 Фабрика объектов, которая используется приложением, для создания объектов
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
263 типа C<IMPL::Web::Application::Action> при обработки C<CGI> запросов.
73
wizard
parents: 67
diff changeset
264
wizard
parents: 67
diff changeset
265 =begin code
wizard
parents: 67
diff changeset
266
wizard
parents: 67
diff changeset
267 my $action = $this->actionFactory->new(
wizard
parents: 67
diff changeset
268 query => $query,
wizard
parents: 67
diff changeset
269 application => $this,
wizard
parents: 67
diff changeset
270 );
wizard
parents: 67
diff changeset
271
wizard
parents: 67
diff changeset
272 =end code
wizard
parents: 67
diff changeset
273
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
274 =item C< [get,set] fetchRequestMethod >
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
275
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
276 Метод получения CGI запроса. Возвращает C<CGI> объект следующего запроса, если
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
277 запросов больше нет, то возвращает C<undef>. По-умолчанию использует C<defaultFetchRequest>.
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
278
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
279 Может быть как ссылкой на функцию, так и объектом типа C<IMPL::Web::Application::RequestFetcher>.
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
280
73
wizard
parents: 67
diff changeset
281 =item C< [get,set,list] handlersQuery >
wizard
parents: 67
diff changeset
282
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
283 Список обработчиков запросов, которые будут переданы созданному объекту-действию.
73
wizard
parents: 67
diff changeset
284
wizard
parents: 67
diff changeset
285 =item C< [get,set] responseCharset>
wizard
parents: 67
diff changeset
286
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
287 Кодировка ответа клиенту.
73
wizard
parents: 67
diff changeset
288
wizard
parents: 67
diff changeset
289 =item C< [get,set] security >
wizard
parents: 67
diff changeset
290
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
291 Объект C<IMPL::Web::Security>, для работы с инфраструктурой безопасности.
73
wizard
parents: 67
diff changeset
292
wizard
parents: 67
diff changeset
293 =item C< [get,set] options >
wizard
parents: 67
diff changeset
294
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
295 Обычно ссылка на хеш с настраиваемыми объектами, используется для возможности
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
296 програмной настройки активаторов, т.к. напрямую через свойства приложения получить
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
297 к ним доступ не получится.
73
wizard
parents: 67
diff changeset
298
wizard
parents: 67
diff changeset
299 =back
wizard
parents: 67
diff changeset
300
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 170
diff changeset
301 =cut