annotate Lib/IMPL/Web/Application/Action.pm @ 166:4267a2ac3d46

Added Class::Template, Rewritten SQL::Schema 'use parent' directive instead of 'use base'
author wizard
date Sat, 23 Apr 2011 23:12:06 +0400
parents b04e978d6d5a
children aaab45153411
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
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 149
diff changeset
4 use parent 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
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
84 sub cookie {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
85 my ($this,$name,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
86
149
b04e978d6d5a minor changes
wizard
parents: 146
diff changeset
87 $this->_launder(scalar( $this->query->cookie($name) ), $rx );
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
88 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
89
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
90 sub param {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
91 my ($this,$name,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
92
146
60fd224f3e3c fixed cgi parameters processing
wizard
parents: 144
diff changeset
93 $this->_launder(scalar( $this->query->param($name) ), $rx );
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
94 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
95
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
96 sub _launder {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
97 my ($this,$value,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
98
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
99 if ( $value ) {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
100 if ($rx) {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
101 if ( my @result = ($value =~ m/$rx/) ) {
149
b04e978d6d5a minor changes
wizard
parents: 146
diff changeset
102 return @result > 1 ? \@result : $result[0];
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
103 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
104 return undef;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
105 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
106 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
107 return $value;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
108 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
109 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
110 return undef;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
111 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
112 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
113
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
114 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
115
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
116 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
117
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
118 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
119
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
120 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
121
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
122 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
123
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
124 =head1 DESCRIPTION
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
125
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
126 C<[Infrastructure]>
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
127
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
128 Определяет порядок выполнения запроса. Запрос выполняется последовательным вызовом
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
129 цепочки обработчиков, при этом обработчики сами вызывают следующие.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
130 Обработчики выполняются в порядке, обратном их добавлению.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
131
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
132 Типичная цепочка может быть такой, в порядке добавления
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
133
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
134 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
135
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
136 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
137 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
138 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
139
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
140 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
141
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
142 что приведет к следующей последовательности
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
143
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
144 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
145
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
146 # the application creates a new Action object
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
147
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
148 my $action = $application->actionFactory->new(
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
149 action => $application, # the application passes self
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
150 query => $query # current CGI query
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
151 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
152
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
153 # forms query handlers stack
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
154
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
155 $action->ChainHandler($_) foreach qw (
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
156 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
157 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
158 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
159 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
160
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
161 # and finally invokes the action
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
162
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
163 $action->Invoke() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
164
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
165 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
166
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
167 IMPL::Web::QueryHandler::PageFormat->Invoke($action,$nextHandlerIsAuthHandler) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
168
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
169 #some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
170
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
171 my $result = $nextHandlerIsAuthHandler() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
172
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
173 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
174
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
175 IMPL::Web::QueryHandler::AuthenticateCookie->Invoke($action,$nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
176
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
177 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
178 # do auth and generate security $context
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
179
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
180 # impersonate $context and call the next handler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
181 return $context->Impersonate($nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
182
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
183 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
184
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
185 IMPL::Web::QueryHandler::SecCallToMethod->Invoke($action,undef) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
186
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
187 # next handler isn't present as it is the last hanler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
188
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
189 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
190 # calculate the $method and the $target from CGI request
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
191
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
192 IMPL::Security->AccessCheck($target,$method);
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
193 return $target->$method();
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
194
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
195 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
196
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
197 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
198
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
199 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
200 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
201
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
202 # some intenals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
203 # formatted output to $action->response->streamBody
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
204 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
205 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
206
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
207 =end code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
208
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
209 или как альтернатива может быть еще
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
210
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
211 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
212
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
213 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
214 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
215 IMPL::Web::QueryHandler::Filter->new( target => IMPL::Transform::ObjectToJSON->new() , method => 'Transform')
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
216 IMLP::Web::QueryHandler::JSONFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
217
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
218
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
219 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
220
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
221 В данной цепочке также происходит вызов метода, но его результат потом преобразуется
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
222 в простые структуры и передается JSON преобразователю. Таким образом модулю логики
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
223 не требуется знать о выходном формате, всю работу проделают дополнительные фильтры.
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
224
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
225 =head1 MEMBERS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
226
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
227 =head2 PROPERTIES
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
228
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
229 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
230
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
231 =item C< [get] application>
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
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
235 =item C< [get] query >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
236
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
237 Экземпляр C<CGI> запроса
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
238
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
239 =item C< [get] response >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
240
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
241 Ответ на C<CGI> заспрос C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
242
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
243 =item C< [get] responseFactory >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
244
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
245 Фабрика ответов на запрос, используется для создания нового ответа
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
246 либо при конструировании текущего объекта C<IMPL::Web::Application::Action>,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
247 либо при вызове метода C<ReinitResponse> у текущего объекта.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
248
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
249 По умолчанию имеет значение C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
250
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
251 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
252
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
253 =head2 METHODS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
254
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
255 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
256
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
257 =item C< ReinitResponse() >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
258
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
259 Отмена старого ответа C<response> и создание вместо него нового.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
260
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
261 Данная операция обычно проводится при обработке ошибок, когда
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
262 уже сформированный ответ требуется отменить. Следует заметить,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
263 что эта операция не возможна, если ответ частично или полностью
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
264 отправлен клиенту. Тогда возникает исключение C<IMPL::InvalidOperationException>.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
265
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
266 =item C< ChainHandler($handler) >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
267
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
268 Добавляет новый обработчик в цепочку. Выполнение цепочки начинается с конца,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
269 тоесть последний добавленный будет выполнен первым.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
270
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
271 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
272
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
273 =head1 HANDLERS
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
274
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
275 =head2 subroutines
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
276
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
277 =over
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
278
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
279 =item CODE ref
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
280
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
281 Ссылка на процедуру может являться обработчиком, при этом функция будет вызвана с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
282 двумя параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
283
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
284 =item Method Name
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
285
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
286 Имя метода, передается в виде строки. У текущего объекта action ищется метод с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
287 указанным именем, после чего используется ссылка на этот метод для вызова с двумя
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
288 параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
289
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
290 Получается вызов идентичный следующему C<< $action->MethodName($nextHandler) >>;
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
291
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
292 =back
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
293
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
294 =head2 C< IMPL::Web::QueryHandler >
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
295
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
296 Любой объект наследованный от C< IMPL::Web::QueryHandler > может быть
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
297 использован в качестве обработчика запроса
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
298
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
299 =cut