annotate Lib/IMPL/Web/Application/Action.pm @ 103:c289ed9662ca

Schema beta 2 More strict validation, support for inflating a simple nodes and properties
author wizard
date Fri, 07 May 2010 18:17:40 +0400
parents 9f5795a10939
children b56ebc31bf18
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
1 package IMPL::Web::Application::Action;
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
2 use strict;
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
3
62
c64bd1bf727d Web application
wizard
parents: 57
diff changeset
4 use base qw(IMPL::Object IMPL::Object::Autofill);
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
5
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
6 __PACKAGE__->PassThroughArgs;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
7
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
8 use IMPL::Class::Property;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
9
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
10 BEGIN {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
11 public property application => prop_get | owner_set;
62
c64bd1bf727d Web application
wizard
parents: 57
diff changeset
12 public property query => prop_get | owner_set;
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
13 public property response => prop_get | owner_set;
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
14 public property responseFactory => prop_get | owner_set;
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
15
609b59c9f03c Web application
wizard
parents: 52
diff changeset
16 private property _entryPoint => prop_all;
609b59c9f03c Web application
wizard
parents: 52
diff changeset
17 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
18
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
19 sub CTOR {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
20 my ($this) = @_;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
21
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
22 $this->responseFactory('IMPL::Web::Application::Response') unless $this->responseFactory;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
23 $this->response( $this->responseFactory->new(query => $this->query) );
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
24 }
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
25
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
26 sub Invoke {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
27 my ($this) = @_;
609b59c9f03c Web application
wizard
parents: 52
diff changeset
28
609b59c9f03c Web application
wizard
parents: 52
diff changeset
29 if ($this->_entryPoint) {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
30 $this->_entryPoint->();
609b59c9f03c Web application
wizard
parents: 52
diff changeset
31 } else {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
32 die new IMPL::InvalidOperationException("At least one handler is required");
609b59c9f03c Web application
wizard
parents: 52
diff changeset
33 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
34 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
35
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
36 sub ReinitResponse {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
37 my ($this) = @_;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
38
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
39 die new IMPL::InvalidOperationException("Response already sent") if $this->response->isHeaderPrinted;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
40
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
41 $this->response->Discard;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
42 $this->response($this->responseFactory->new(query => $this->query));
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
43 }
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
44
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
45 sub ChainHandler {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
46 my ($this,$handler) = @_;
609b59c9f03c Web application
wizard
parents: 52
diff changeset
47
609b59c9f03c Web application
wizard
parents: 52
diff changeset
48 my $delegateNext = $this->_entryPoint();
609b59c9f03c Web application
wizard
parents: 52
diff changeset
49
609b59c9f03c Web application
wizard
parents: 52
diff changeset
50 if (ref $handler eq 'CODE') {
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
51 $this->_entryPoint( sub {
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
52 $handler->($this,$delegateNext);
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
53 } );
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
54 } elsif (ref $handler and UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
55 $this->_entryPoint( sub {
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
56 $handler->Invoke($this,$delegateNext);
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
57 } );
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
58 } elsif ($handler and not ref $handler) {
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
59
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
60 if (my $method = $this->can($handler) ) {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
61 $this->_entryPoint( sub {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
62 $method->($this,$delegateNext);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
63 } );
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
64 } else {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
65 {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
66 no strict 'refs';
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
67 eval "require $handler; 1;" or die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler,"Failed to load module") unless keys %{"${handler}::"};
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
68 }
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
69
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
70 if (UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
71 $this->_entryPoint( sub {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
72 $handler->Invoke($this,$delegateNext);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
73 } );
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
74 } else {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
75 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
76 }
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
77 }
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
78 } else {
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
79 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
80 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
81
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
82 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
83
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
84 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
85
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
86 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
87
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
88 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
89
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
90 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
91
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
92 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
93
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
94 =head1 DESCRIPTION
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
95
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
96 C<[Infrastructure]>
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
97
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
98 Определяет порядок выполнения запроса. Запрос выполняется последовательным вызовом
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
99 цепочки обработчиков, при этом обработчики сами вызывают следующие.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
100 Обработчики выполняются в порядке, обратном их добавлению.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
101
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
102 Типичная цепочка может быть такой, в порядке добавления
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
103
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
104 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
105
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
106 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
107 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
108 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
109
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
110 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
111
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
112 что приведет к следующей последовательности
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
113
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
114 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
115
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
116 # the application creates a new Action object
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
117
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
118 my $action = $application->actionFactory->new(
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
119 action => $application, # the application passes self
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
120 query => $query # current CGI query
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
121 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
122
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
123 # forms query handlers stack
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
124
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
125 $action->ChainHandler($_) foreach qw (
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
126 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
127 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
128 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
129 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
130
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
131 # and finally invokes the action
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
132
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
133 $action->Invoke() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
134
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
135 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
136
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
137 IMPL::Web::QueryHandler::PageFormat->Invoke($action,$nextHandlerIsAuthHandler) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
138
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
139 #some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
140
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
141 my $result = $nextHandlerIsAuthHandler() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
142
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
143 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
144
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
145 IMPL::Web::QueryHandler::AuthenticateCookie->Invoke($action,$nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
146
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
147 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
148 # do auth and generate security $context
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
149
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
150 # impersonate $context and call the next handler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
151 return $context->Impersonate($nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
152
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
153 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
154
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
155 IMPL::Web::QueryHandler::SecCallToMethod->Invoke($action,undef) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
156
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
157 # next handler isn't present as it is the last hanler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
158
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
159 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
160 # calculate the $method and the $target from CGI request
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
161
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
162 IMPL::Security->AccessCheck($target,$method);
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
163 return $target->$method();
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
164
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
165 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
166
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
167 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
168
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
169 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
170 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
171
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
172 # some intenals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
173 # formatted output to $action->response->streamBody
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
174 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
175 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
176
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
177 =end code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
178
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
179 или как альтернатива может быть еще
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
180
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
181 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
182
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
183 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
184 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
185 IMPL::Web::QueryHandler::Filter->new( target => IMPL::Transform::ObjectToJSON->new() , method => 'Transform')
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
186 IMLP::Web::QueryHandler::JSONFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
187
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
188
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
189 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
190
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
191 В данной цепочке также происходит вызов метода, но его результат потом преобразуется
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
192 в простые структуры и передается JSON преобразователю. Таким образом модулю логики
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
193 не требуется знать о выходном формате, всю работу проделают дополнительные фильтры.
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
194
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
195 =head1 MEMBERS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
196
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
197 =head2 PROPERTIES
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
198
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
199 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
200
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
201 =item C< [get] application>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
202
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
203 Экземпляр приложения создавшего текущий объект
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
204
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
205 =item C< [get] query >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
206
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
207 Экземпляр C<CGI> запроса
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
208
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
209 =item C< [get] response >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
210
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
211 Ответ на C<CGI> заспрос C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
212
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
213 =item C< [get] responseFactory >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
214
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
215 Фабрика ответов на запрос, используется для создания нового ответа
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
216 либо при конструировании текущего объекта C<IMPL::Web::Application::Action>,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
217 либо при вызове метода C<ReinitResponse> у текущего объекта.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
218
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
219 По умолчанию имеет значение C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
220
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
221 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
222
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
223 =head2 METHODS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
224
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
225 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
226
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
227 =item C< ReinitResponse() >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
228
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
229 Отмена старого ответа C<response> и создание вместо него нового.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
230
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
231 Данная операция обычно проводится при обработке ошибок, когда
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
232 уже сформированный ответ требуется отменить. Следует заметить,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
233 что эта операция не возможна, если ответ частично или полностью
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
234 отправлен клиенту. Тогда возникает исключение C<IMPL::InvalidOperationException>.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
235
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
236 =item C< ChainHandler($handler) >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
237
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
238 Добавляет новый обработчик в цепочку. Выполнение цепочки начинается с конца,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
239 тоесть последний добавленный будет выполнен первым.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
240
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
241 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
242
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
243 =head1 HANDLERS
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
244
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
245 =head2 subroutines
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
246
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
247 =over
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
248
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
249 =item CODE ref
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
250
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
251 Ссылка на процедуру может являться обработчиком, при этом функция будет вызвана с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
252 двумя параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
253
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
254 =item Method Name
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
255
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
256 Имя метода, передается в виде строки. У текущего объекта action ищется метод с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
257 указанным именем, после чего используется ссылка на этот метод для вызова с двумя
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
258 параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
259
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
260 Получается вызов идентичный следующему C<< $action->MethodName($nextHandler) >>;
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
261
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
262 =back
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
263
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
264 =head2 C< IMPL::Web::QueryHandler >
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
265
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
266 Любой объект наследованный от C< IMPL::Web::QueryHandler > может быть
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
267 использован в качестве обработчика запроса
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
268
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
269 =cut