annotate Lib/IMPL/Web/Application/Action.pm @ 179:b3d91ff7aea9

minor changes
author sourcer
date Tue, 20 Dec 2011 23:00:30 +0300
parents aaab45153411
children d1676be8afcc
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;
173
aaab45153411 minor bugfixes
sourcer
parents: 166
diff changeset
15 public property context => prop_get | owner_set;
55
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) );
173
aaab45153411 minor bugfixes
sourcer
parents: 166
diff changeset
24 $this->context({});
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
25 }
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
26
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
27 sub Invoke {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
28 my ($this) = @_;
609b59c9f03c Web application
wizard
parents: 52
diff changeset
29
609b59c9f03c Web application
wizard
parents: 52
diff changeset
30 if ($this->_entryPoint) {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
31 $this->_entryPoint->();
609b59c9f03c Web application
wizard
parents: 52
diff changeset
32 } else {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
33 die new IMPL::InvalidOperationException("At least one handler is required");
609b59c9f03c Web application
wizard
parents: 52
diff changeset
34 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
35 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
36
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
37 sub ReinitResponse {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
38 my ($this) = @_;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
39
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
40 die new IMPL::InvalidOperationException("Response already sent") if $this->response->isHeaderPrinted;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
41
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
42 $this->response->Discard;
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
43 $this->response($this->responseFactory->new(query => $this->query));
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
44 }
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
45
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
46 sub ChainHandler {
609b59c9f03c Web application
wizard
parents: 52
diff changeset
47 my ($this,$handler) = @_;
609b59c9f03c Web application
wizard
parents: 52
diff changeset
48
609b59c9f03c Web application
wizard
parents: 52
diff changeset
49 my $delegateNext = $this->_entryPoint();
609b59c9f03c Web application
wizard
parents: 52
diff changeset
50
609b59c9f03c Web application
wizard
parents: 52
diff changeset
51 if (ref $handler eq 'CODE') {
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
52 $this->_entryPoint( sub {
173
aaab45153411 minor bugfixes
sourcer
parents: 166
diff changeset
53 $handler->($this,$delegateNext);
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
54 } );
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
55 } elsif (ref $handler and UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
56 $this->_entryPoint( sub {
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
57 $handler->Invoke($this,$delegateNext);
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
58 } );
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
59 } elsif ($handler and not ref $handler) {
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
60
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
61 if (my $method = $this->can($handler) ) {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
62 $this->_entryPoint( sub {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
63 $method->($this,$delegateNext);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
64 } );
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
65 } else {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
66 {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
67 no strict 'refs';
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
68 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
69 }
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
70
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
71 if (UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
72 $this->_entryPoint( sub {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
73 $handler->Invoke($this,$delegateNext);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
74 } );
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
75 } else {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
76 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
77 }
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
78 }
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
79 } else {
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
80 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
81 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
82
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
83 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
84
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
85 sub cookie {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
86 my ($this,$name,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
87
149
b04e978d6d5a minor changes
wizard
parents: 146
diff changeset
88 $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
89 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
90
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
91 sub param {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
92 my ($this,$name,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
93
146
60fd224f3e3c fixed cgi parameters processing
wizard
parents: 144
diff changeset
94 $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
95 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
96
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
97 sub _launder {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
98 my ($this,$value,$rx) = @_;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
99
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
100 if ( $value ) {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
101 if ($rx) {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
102 if ( my @result = ($value =~ m/$rx/) ) {
149
b04e978d6d5a minor changes
wizard
parents: 146
diff changeset
103 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
104 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
105 return undef;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
106 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
107 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
108 return $value;
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
109 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
110 } else {
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
111 return undef;
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 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
114
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
115 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
116
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
117 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
118
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
119 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
120
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
121 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
122
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
123 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
124
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
125 =head1 DESCRIPTION
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
126
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
127 C<[Infrastructure]>
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
128
67
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 Обработчики выполняются в порядке, обратном их добавлению.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
132
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
133 Типичная цепочка может быть такой, в порядке добавления
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
134
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
135 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
136
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
137 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
138 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
139 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
140
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
141 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
142
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
143 что приведет к следующей последовательности
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
144
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
145 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
146
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
147 # the application creates a new Action object
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
148
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
149 my $action = $application->actionFactory->new(
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
150 action => $application, # the application passes self
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
151 query => $query # current CGI query
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
152 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
153
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
154 # forms query handlers stack
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
155
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
156 $action->ChainHandler($_) foreach qw (
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
157 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
158 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
159 IMPL::Web::QueryHandler::PageFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
160 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
161
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
162 # and finally invokes the action
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
163
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
164 $action->Invoke() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
165
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
166 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
167
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
168 IMPL::Web::QueryHandler::PageFormat->Invoke($action,$nextHandlerIsAuthHandler) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
169
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
170 #some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
171
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
172 my $result = $nextHandlerIsAuthHandler() {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
173
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
174 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
175
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
176 IMPL::Web::QueryHandler::AuthenticateCookie->Invoke($action,$nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
177
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
178 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
179 # do auth and generate security $context
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
180
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
181 # impersonate $context and call the next handler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
182 return $context->Impersonate($nextHandlerIsSecCall) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
183
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
184 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
185
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
186 IMPL::Web::QueryHandler::SecCallToMethod->Invoke($action,undef) {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
187
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
188 # next handler isn't present as it is the last hanler
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
189
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
190 # some internals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
191 # calculate the $method and the $target from CGI request
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
192
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
193 IMPL::Security->AccessCheck($target,$method);
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
194 return $target->$method();
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
195
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
196 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
197
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
198 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
199
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
200 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
201 }
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
202
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
203 # some intenals
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
204 # formatted output to $action->response->streamBody
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
205 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
206 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
207
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
208 =end code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
209
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
210 или как альтернатива может быть еще
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
211
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
212 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
213
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
214 IMPL::Web::QueryHandler::SecCallToMethod
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
215 IMPL::Web::QueryHandler::AuthenticateCookie
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
216 IMPL::Web::QueryHandler::Filter->new( target => IMPL::Transform::ObjectToJSON->new() , method => 'Transform')
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
217 IMLP::Web::QueryHandler::JSONFormat
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
218
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
219
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
220 =end code
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
221
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
222 В данной цепочке также происходит вызов метода, но его результат потом преобразуется
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
223 в простые структуры и передается JSON преобразователю. Таким образом модулю логики
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
224 не требуется знать о выходном формате, всю работу проделают дополнительные фильтры.
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
225
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
226 =head1 MEMBERS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
227
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
228 =head2 PROPERTIES
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
229
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
230 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
231
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
232 =item C< [get] application>
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
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
236 =item C< [get] query >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
237
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
238 Экземпляр C<CGI> запроса
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
239
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
240 =item C< [get] response >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
241
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
242 Ответ на C<CGI> заспрос C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
243
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
244 =item C< [get] responseFactory >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
245
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
246 Фабрика ответов на запрос, используется для создания нового ответа
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
247 либо при конструировании текущего объекта C<IMPL::Web::Application::Action>,
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
248 либо при вызове метода C<ReinitResponse> у текущего объекта.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
249
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
250 По умолчанию имеет значение C<IMPL::Web::Application::Response>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
251
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
252 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
253
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
254 =head2 METHODS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
255
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
256 =over
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
257
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
258 =item C< ReinitResponse() >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
259
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
260 Отмена старого ответа C<response> и создание вместо него нового.
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 что эта операция не возможна, если ответ частично или полностью
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
265 отправлен клиенту. Тогда возникает исключение C<IMPL::InvalidOperationException>.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
266
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
267 =item C< ChainHandler($handler) >
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
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
272 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
273
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
274 =head1 HANDLERS
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
275
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
276 =head2 subroutines
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
277
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
278 =over
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
279
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
280 =item CODE ref
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
281
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
282 Ссылка на процедуру может являться обработчиком, при этом функция будет вызвана с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
283 двумя параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
284
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
285 =item Method Name
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
286
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
287 Имя метода, передается в виде строки. У текущего объекта action ищется метод с
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
288 указанным именем, после чего используется ссылка на этот метод для вызова с двумя
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
289 параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
290
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
291 Получается вызов идентичный следующему C<< $action->MethodName($nextHandler) >>;
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
292
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
293 =back
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
294
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
295 =head2 C< IMPL::Web::QueryHandler >
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
296
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
297 Любой объект наследованный от C< IMPL::Web::QueryHandler > может быть
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
298 использован в качестве обработчика запроса
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
299
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
300 =cut