annotate Lib/IMPL/Web/Application/Action.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children c8fe3f84feba
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
11 public property application => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
12 public property query => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
13 public property response => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14 public property responseFactory => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
15 public property context => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 private property _entryPoint => prop_all;
55
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22 $this->responseFactory('IMPL::Web::Application::Response') unless $this->responseFactory;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 $this->response( $this->responseFactory->new(query => $this->query) );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 if ($this->_entryPoint) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 $this->_entryPoint->();
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33 die new IMPL::InvalidOperationException("At least one handler is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 }
55
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
38 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
39
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
40 die new IMPL::InvalidOperationException("Response already sent") if $this->response->isHeaderPrinted;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
41
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
42 $this->response->Discard;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
43 $this->response($this->responseFactory->new(query => $this->query));
65
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
47 my ($this,$handler) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
48
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
49 my $delegateNext = $this->_entryPoint();
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
50
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
51 if (ref $handler eq 'CODE') {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
52 $this->_entryPoint( sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
53 $handler->($this,$delegateNext);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
54 } );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
55 } elsif (ref $handler and UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
56 $this->_entryPoint( sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
57 $handler->Invoke($this,$delegateNext);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
58 } );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
59 } elsif ($handler and not ref $handler) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
60
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
61 if (my $method = $this->can($handler) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
62 $this->_entryPoint( sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
63 $method->($this,$delegateNext);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
64 } );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
65 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
66 {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
67 no strict 'refs';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
68 eval "require $handler; 1;" or die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler,"Failed to load module") unless keys %{"${handler}::"};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
69 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
71 if (UNIVERSAL::isa($handler,'IMPL::Web::QueryHandler')) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
72 $this->_entryPoint( sub {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
73 $handler->Invoke($this,$delegateNext);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
74 } );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
75 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
76 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
77 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
78 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
79 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
80 die new IMPL::InvalidArgumentException("An invalid handler supplied",$handler);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
81 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
86 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
87
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
92 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
93
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
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 {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
98 my ($this,$value,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
99
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
100 if ( $value ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
101 if ($rx) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
102 if ( my @result = ($value =~ m/$rx/) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
103 return @result > 1 ? \@result : $result[0];
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
104 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
105 return undef;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
106 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
107 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
108 return $value;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
109 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
110 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
111 return undef;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
112 }
144
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
123 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
129 Определяет порядок выполнения запроса. Запрос выполняется последовательным вызовом
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
130 цепочки обработчиков, при этом обработчики сами вызывают следующие.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
131 Обработчики выполняются в порядке, обратном их добавлению.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
132
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
133 Типичная цепочка может быть такой, в порядке добавления
52
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
143 что приведет к следующей последовательности
52
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(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
150 action => $application, # the application passes self
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
151 query => $query # current CGI query
67
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 (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
157 IMPL::Web::QueryHandler::SecCallToMethod
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
158 IMPL::Web::QueryHandler::AuthenticateCookie
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
159 IMPL::Web::QueryHandler::PageFormat
67
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() {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
165
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
166 # some internals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
167
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
168 IMPL::Web::QueryHandler::PageFormat->Invoke($action,$nextHandlerIsAuthHandler) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
169
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
170 #some internals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
171
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
172 my $result = $nextHandlerIsAuthHandler() {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
173
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
174 # some internals
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
175
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
176 IMPL::Web::QueryHandler::AuthenticateCookie->Invoke($action,$nextHandlerIsSecCall) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
177
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
178 # some internals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
179 # do auth and generate security $context
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
180
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
181 # impersonate $context and call the next handler
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
182 return $context->Impersonate($nextHandlerIsSecCall) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
183
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
184 # some internals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
185
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
186 IMPL::Web::QueryHandler::SecCallToMethod->Invoke($action,undef) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
187
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
188 # next handler isn't present as it is the last hanler
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
189
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
190 # some internals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
191 # calculate the $method and the $target from CGI request
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
192
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
193 IMPL::Security->AccessCheck($target,$method);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
194 return $target->$method();
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
195
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
196 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
197
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
198 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
199
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
200 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
201 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
202
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
203 # some intenals
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
204 # formatted output to $action->response->streamBody
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
205 }
52
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
210 или как альтернатива может быть еще
52
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
222 В данной цепочке также происходит вызов метода, но его результат потом преобразуется
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
223 в простые структуры и передается JSON преобразователю. Таким образом модулю логики
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
224 не требуется знать о выходном формате, всю работу проделают дополнительные фильтры.
52
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
234 Экземпляр приложения создавшего текущий объект
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
238 Экземпляр C<CGI> запроса
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
242 Ответ на C<CGI> заспрос C<IMPL::Web::Application::Response>
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
246 Фабрика ответов на запрос, используется для создания нового ответа
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
247 либо при конструировании текущего объекта C<IMPL::Web::Application::Action>,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
248 либо при вызове метода C<ReinitResponse> у текущего объекта.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
249
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
250 По умолчанию имеет значение C<IMPL::Web::Application::Response>
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
260 Отмена старого ответа C<response> и создание вместо него нового.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
261
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
262 Данная операция обычно проводится при обработке ошибок, когда
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
263 уже сформированный ответ требуется отменить. Следует заметить,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
264 что эта операция не возможна, если ответ частично или полностью
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
265 отправлен клиенту. Тогда возникает исключение C<IMPL::InvalidOperationException>.
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
269 Добавляет новый обработчик в цепочку. Выполнение цепочки начинается с конца,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
270 тоесть последний добавленный будет выполнен первым.
67
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
282 Ссылка на процедуру может являться обработчиком, при этом функция будет вызвана с
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
283 двумя параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
56
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
287 Имя метода, передается в виде строки. У текущего объекта action ищется метод с
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
288 указанным именем, после чего используется ссылка на этот метод для вызова с двумя
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
289 параметрами: ссылкой на action объект, и точкой входа следующего обработчика.
56
117b6956d5a5 Web application in progress
wizard
parents: 55
diff changeset
290
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
291 Получается вызов идентичный следующему C<< $action->MethodName($nextHandler) >>;
56
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
297 Любой объект наследованный от C< IMPL::Web::QueryHandler > может быть
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
298 использован в качестве обработчика запроса
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 56
diff changeset
299
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
300 =cut