Mercurial > pub > Impl
annotate Lib/IMPL/Web/Application/RestResource.pm @ 200:a9dbe534d236
sync
author | sergey |
---|---|
date | Tue, 24 Apr 2012 02:34:49 +0400 |
parents | e743a8481327 |
children | 0c018a247c8a |
rev | line source |
---|---|
196 | 1 package IMPL::Web::Application::RestResource; |
2 use strict; | |
3 | |
198 | 4 use IMPL::lang qw(:declare :constants is); |
5 use IMPL::Exception(); | |
6 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
7 use IMPL::declare { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
8 require => { |
198 | 9 ForbiddenException => 'IMPL::Web::ForbiddenException', |
200 | 10 NotFoundException => 'IMPL::Web::NotFoundException', |
198 | 11 InvalidOpException => '-IMPL::InvalidOperationException', |
12 ArgumentException => '-IMPL::InvalidArgumentException', | |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
13 TTransform => '-IMPL::Transform', |
200 | 14 TResolve => '-IMPL::Config::Resolve', |
15 CustomResource => 'IMPL::Web::Application::CustomResource' | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
16 }, |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
17 base => { |
200 | 18 'IMPL::Web::Application::RestBaseResource' => '@_' |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
19 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
20 }; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
21 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
22 BEGIN { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
23 public property target => PROP_GET | PROP_OWNERSET; |
200 | 24 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
25 public property methods => PROP_GET | PROP_OWNERSET; |
200 | 26 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
27 public property childRegex => PROP_GET | PROP_OWNERSET; |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
28 public property enableForms => PROP_GET | PROP_OWNERSET; |
200 | 29 public property orphan => PROP_GET | PROP_OWNERSET; |
30 | |
31 public property listChildren => PROP_GET | PROP_OWNERSET; | |
32 public property fetchChild => PROP_GET | PROP_OWNERSET; | |
33 public property createChild => PROP_GET | PROP_OWNERSET; | |
34 public property updateChild => PROP_GET | PROP_OWNERSET; | |
35 public property deleteChild => PROP_GET | PROP_OWNERSET; | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
36 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
37 |
198 | 38 sub CTOR { |
39 my ($this) = @_; | |
40 | |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
41 die ArgumentException->new("id","Identifier is required for non-root resources") if $this->id and not length $this->id; |
198 | 42 die ArgumentException->new("target") unless $this->target; |
200 | 43 die ArgumentException->new("A contract is required") unless $this->contract; |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
44 |
200 | 45 if ($this->enableForms) { |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
46 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
47 } |
198 | 48 } |
49 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
50 sub GetImpl { |
200 | 51 my ($this,$action) = @_; |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
52 |
200 | 53 return $this->target; |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
54 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
55 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
56 sub PutImpl { |
200 | 57 my ($this,$action) = @_; |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
58 |
200 | 59 die ForbiddenException->new() if $this->orhpan; |
60 | |
61 $this->parent->UpdateImpl($this->id,$action); | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
62 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
63 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
64 sub PostImpl { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
65 my ($this,$id,$action) = @_; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
66 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
67 my $method; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
68 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
69 if (length $id == 0) { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
70 $method = $this->insert or die ForbiddenException->new(); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
71 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
72 $method = { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
73 method => $method, |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
74 parameters => [qw(query)] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
75 } unless ref $method; |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
76 } elsif ($this->methods and $method = $this->methods->{$id}->{post}) { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
77 # we got method info |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
78 } else { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
79 die ForbiddenException->new(); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
80 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
81 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
82 return $this->InvokeMemeber($method,$id,$action); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
83 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
84 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
85 sub DeleteImpl { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
86 my ($this,$id,$action) = @_; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
87 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
88 my $rx = $this->childRegex; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
89 if ($rx and $id =~ m/$rx/ and my $method = $this->delete) { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
90 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
91 $method = { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
92 method => $method, |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
93 parameters => [qw(id)] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
94 } unless ref $method; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
95 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
96 return $this->InvokeMember($method,$id,$action); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
97 } else { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
98 die ForbiddenException->new(); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
99 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
100 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
101 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
102 sub HttpFallbackImpl { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
103 die ForbiddenException->new(); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
104 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
105 |
200 | 106 sub UpdateImpl { |
107 my ($this,$id,$action) = @_; | |
108 | |
109 my $method = $this->updateChild or die ForbiddenException->new(); | |
110 $this->InvokeMember($method,$action); | |
111 } | |
112 | |
113 sub FetchChildResource { | |
114 my ($this,$id,$action) = @_; | |
115 | |
116 my $rx = $this->childRegex; | |
117 my $method; | |
118 my %params = ( | |
119 parent => $this, | |
120 id => $id | |
121 ); | |
122 | |
123 if (length $id == 0) { | |
124 | |
125 $method = $this->list; | |
126 die ForbiddenException->new() unless $method; | |
127 | |
128 return $this->contract->Transform( $this->InvokeMember($method,$id,$action), \%params ); | |
129 | |
130 } elsif ($method = $this->methods->{$id}) { | |
131 # поскольку данный объект был получен не как дочерний объект, | |
132 # а как выполнение метода, то для него не определены операции | |
133 # put и delete по умолчанию. | |
134 $params{orphan} = 1; | |
135 | |
136 return $this->contract->Transform( $this->InvokeMember($method,$id,$action), \%params ); | |
137 | |
138 } elsif ($rx and $id =~ m/^$rx$/ and $method = $this->fetch) { | |
139 # ok | |
140 } else { | |
141 die ForbiddenException->new(); | |
142 } | |
143 | |
144 my $res = $this->InvokeMember($method,$id,$action); | |
145 die NotFoundException->new() unless defined $res; | |
146 | |
147 return $this->contract->Transform($res, {parent => $this, id => $id} ); | |
148 } | |
149 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
150 sub InvokeMember { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
151 my ($this,$method,$id,$action) = @_; |
198 | 152 |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
153 die ArgumentException->new("method","No method information provided") unless $method; |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
154 |
198 | 155 #normalize method info |
156 if (not ref $method) { | |
157 $method = { | |
158 method => $method | |
159 }; | |
160 } | |
161 | |
162 if (ref $method eq 'HASH') { | |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
163 my $member = $method->{method} or die InvalidOpException->new("A member name isn't specified"); |
198 | 164 my @args; |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
165 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
166 if (my $params = $method->{parameters}) { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
167 if (ref $params eq 'HASH') { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
168 @args = map { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
169 $_, |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
170 $this->MakeParameter($params->{$_},$id,$action) |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
171 } keys %$params; |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
172 } elsif (ref $params eq 'ARRAY') { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
173 @args = map $this->MakeParameter($_,$id,$action), @$params; |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
174 } else { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
175 @args = ($this->MakeParameter($params,$id,$action)); |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
176 } |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
177 } |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
178 return $this->target->$member(@args); |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
179 } elsif (ref $method eq TResolve) { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
180 return $method->Invoke($this->target); |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
181 } elsif (ref $method eq 'CODE') { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
182 return $method->($this,$id,$action); |
198 | 183 } else { |
184 die InvalidOpException->new("Unsupported type of the method information", ref $method); | |
185 } | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
186 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
187 |
198 | 188 sub MakeParameter { |
189 my ($this,$param,$id,$action) = @_; | |
190 | |
191 if ($param) { | |
192 if (is $param, TTransform ) { | |
193 return $param->Transform($this,$action->query); | |
194 } elsif ($param and not ref $param) { | |
195 my %std = ( | |
196 id => $id, | |
197 action => $action, | |
198 query => $action->query | |
199 ); | |
200 | |
201 return $std{$param} || $action->query->param($param); | |
202 } | |
203 } else { | |
204 return undef; | |
205 } | |
206 } | |
207 | |
208 | |
209 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
210 |
196 | 211 1; |
212 | |
213 __END__ | |
214 | |
215 =pod | |
216 | |
217 =head1 NAME | |
218 | |
219 C<IMPL::Web::Application::RestResource> - ресурс Rest вебсервиса. | |
220 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
221 =head1 SYNOPSIS |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
222 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
223 =begin text |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
224 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
225 [REQUEST] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
226 GET /artists |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
227 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
228 [RESPONSE] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
229 <artists> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
230 <artist id="1"> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
231 <name>The Beatles <name/> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
232 </atrist> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
233 <artist id="2"> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
234 <name>Bonobo</name> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
235 </artist> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
236 </artists> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
237 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
238 [REQUEST] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
239 GET /artists/1/cds?title='Live at BBC' |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
240 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
241 [RESPONSE] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
242 <cds> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
243 <cd id="14"> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
244 <title>Live at BBC 1</title> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
245 </cd> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
246 <cd id="15"> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
247 <title>Live at BBC 2</title> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
248 </cd> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
249 </cds> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
250 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
251 [REQUEST] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
252 GET /cds/15 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
253 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
254 [RESPONSE] |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
255 <cd id="15"> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
256 <title>Live at BBC 2</title> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
257 </cd> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
258 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
259 =end text |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
260 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
261 =begin code |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
262 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
263 use IMPL::require { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
264 TRes => 'IMPL::Web:Application::RestResource', |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
265 DataContext => 'My::App::DataContext' |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
266 }; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
267 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
268 my $cds = TRes->new( |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
269 DataContext->Default, |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
270 { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
271 methods => { |
198 | 272 history => { |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
273 get => { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
274 method => 'GetHistory', |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
275 parameters => [qw(from to)] |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
276 }, |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
277 }, |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
278 rating => { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
279 get => { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
280 method => 'GetRating' |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
281 } |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
282 post => { |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
283 method => 'Vote', |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
284 parameters => [qw(id rating comment)] |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
285 } |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
286 } |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
287 } |
198 | 288 list => 'search', |
289 fetch => 'GetItemById' | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
290 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
291 ); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
292 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
293 =end code |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
294 |
196 | 295 =head1 DESCRIPTION |
296 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
297 Каждый ресурс представляет собой коллекцию и реализует методы C<HTTP> C<GET,POST,PUT,DELETE>. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
298 |
200 | 299 Ресурсы выстраиваются в иерархию, на основе пути. Поиск конечного реурса происходит последовательным |
300 вызовом метода GET с именем очередного ресурса. | |
301 | |
302 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
303 =head2 HTTP METHODS |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
304 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
305 =head3 C<GET> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
306 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
307 Возвращает коллекцию дочерних ресурсов. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
308 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
309 =head3 C<GET {id}> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
310 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
311 Возвращает дочерний объект с идентификатором C<id> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
312 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
313 =head3 C<GET {method}> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
314 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
315 Вызывает метод C<method> и возвращает его результаты. При публикации методов доступных |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
316 через C<GET> данные методы не должны вносить изменений в предметную область. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
317 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
318 =head3 C<PUT {id}> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
319 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
320 Обновляет дочерний ресурс с указанным идентификатором. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
321 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
322 =head3 C<DELETE {id}> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
323 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
324 Удаляет дочерний ресурс с указанным идентификатором. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
325 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
326 =head3 C<POST> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
327 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
328 Добавляет новый дочерний ресурс в коллекцию. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
329 |
198 | 330 =head3 C<POST {method}> |
331 | |
332 Вызывает метод C<method>. | |
333 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
334 =head2 HTTP METHOD MAPPING |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
335 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
336 =head3 C<POST {method}> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
337 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
338 Вызывает метод C<method>, в отличии от C<GET> методы опубликованные через C<POST> могут вносить |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
339 изменения в объекты. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
340 |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
341 =head1 BROWSER COMPATIBILITY |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
342 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
343 Однако существует проблема с браузерами, поскольку тег C<< <form> >> реализет только методы |
200 | 344 C<GET,POST>. Для решения данной проблемы используется режим совместимости C<enableForms>. В |
345 случае когда данный режим активен, автоматически публикуются дочерние ресурсы C<create,edit,delete>. | |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
346 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
347 =head2 C<GET create> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
348 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
349 Возвращает C<target>. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
350 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
351 =head2 C<POST create> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
352 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
353 Вызывает метод C<PostImpl> передавая ему свои параметры. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
354 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
355 =head2 C<GET edit> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
356 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
357 Возвращает C<target>. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
358 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
359 =head2 C<POST edit> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
360 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
361 Вызывает метод C<$this->parent->PutImpl($this->id)> передавая ему свои параметры. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
362 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
363 =head2 C<GET delete>. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
364 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
365 Возвращает C<target>. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
366 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
367 =head2 C<POST delete>. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
368 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
369 Вызывает метод C<$this->parent->DeleteImpl($this->id)> передавая ему свои параметры. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
370 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
371 =head1 MEMBERS |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
372 |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
373 =head2 C<[get]id> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
374 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
375 Идентификатор текущего ресурса. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
376 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
377 =head2 C<[get]target> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
378 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
379 Объект (также может быть и класс), обеспечивающий функционал ресурса. |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
380 |
199
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
381 =head2 C<[get]parent> |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
382 |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
383 Родительский ресурс, в котором находится текущий ресурс. Может быть C<undef>, |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
384 если текущий ресурс является корнем. |
e743a8481327
Added REST support for forms (with only get and post methods)
sergey
parents:
198
diff
changeset
|
385 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
386 =head2 C<[get]methods> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
387 |
198 | 388 Содержит описания методов, которые будут публиковаться как дочерние ресурсы. |
389 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
390 =head2 C<[get]childRegex> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
391 |
198 | 392 Содержит регулярное выражение для идентификаторов дочерних объектов. Если оно |
393 не задано, то данный ресурс не является коллекцией. | |
394 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
395 =head2 C<[get]fetch> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
396 |
198 | 397 Содержит описание метода для получения дочернего объекта. Если данный метод |
398 отсутствует, то дочерние ресурсы не получится адресовать относительно данного. | |
399 По умолчанию получает идентификатор дочернего ресурса первым параметром. | |
400 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
401 =head2 C<[get]list> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
402 |
198 | 403 Описание метода для получения списка дочерних объектов. По умолчанию не |
404 получает параметров. | |
405 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
406 =head2 C<[get]insert> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
407 |
198 | 408 Описание метода для добавление дочернего ресурса. По умолчанию получает |
409 объект C<CGI> описывабщий текущий запрос первым параметром. | |
410 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
411 =head2 C<[get]update> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
412 |
198 | 413 Описание метода для обновления дочернего ресурса. По умолчанию получает |
414 идентификатор дочернего ресурса и объект C<CGI> текущего запроса. | |
415 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
416 =head2 C<[get]delete> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
417 |
198 | 418 Описание метода для удаления дочернего ресурса. По умолчанию получает |
419 идентификатор дочернего ресурса. | |
420 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
421 =head2 C<GetImpl($child,$action)> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
422 |
198 | 423 =over |
424 | |
425 =item C<$child> | |
426 | |
427 Идентификатор дочернего ресутсра | |
428 | |
429 =item C<$action> | |
430 | |
431 Текущий запрос C<IMPL::Web::Application::Action>. | |
432 | |
433 =back | |
434 | |
435 Переадресует запрос нужному методу внутреннего объекта C<target> при | |
436 помощи C<InvokeMember>. | |
437 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
438 =head2 C<PutImpl($child,$action)> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
439 |
198 | 440 =over |
441 | |
442 =item C<$child> | |
443 | |
444 Идентификатор дочернего ресутсра | |
445 | |
446 =item C<$action> | |
447 | |
448 Текущий запрос C<IMPL::Web::Application::Action>. | |
449 | |
450 =back | |
451 | |
452 Переадресует запрос нужному методу внутреннего объекта C<target> при | |
453 помощи C<InvokeMember>. | |
454 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
455 =head2 C<PostImpl($child,$action)> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
456 |
198 | 457 =over |
458 | |
459 =item C<$child> | |
460 | |
461 Идентификатор дочернего ресутсра | |
462 | |
463 =item C<$action> | |
464 | |
465 Текущий запрос C<IMPL::Web::Application::Action>. | |
466 | |
467 =back | |
468 | |
469 Переадресует запрос нужному методу внутреннего объекта C<target> при | |
470 помощи C<InvokeMember>. | |
471 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
472 =head2 C<DeleteImpl($child,$action)> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
473 |
198 | 474 =over |
475 | |
476 =item C<$child> | |
477 | |
478 Идентификатор дочернего ресутсра | |
479 | |
480 =item C<$action> | |
481 | |
482 Текущий запрос C<IMPL::Web::Application::Action>. | |
483 | |
484 =back | |
485 | |
486 Переадресует запрос нужному методу внутреннего объекта C<target> при | |
487 помощи C<InvokeMember>. | |
488 | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
489 =head2 C<InvokeMember($memberInfo,$child,$action)> |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
196
diff
changeset
|
490 |
198 | 491 =over |
492 | |
493 =item C<$memberInfo> | |
494 | |
495 Описание члена внутреннего объекта C<target>, который нужно вызвать. | |
496 | |
497 =item C<$child> | |
498 | |
499 Идентификатор дочернего ресутсра | |
500 | |
501 =item C<$action> | |
502 | |
503 Текущий запрос C<IMPL::Web::Application::Action>. | |
504 | |
505 =back | |
506 | |
507 Вызывает метод внутреннего объекта C<target>, предварительно подготовив | |
508 параметры на основе описания C<$memberInfo> и при помощи С<MakeParameter()>. | |
509 | |
510 =head2 C<MakeParameter($paramDef,$child,$action)> | |
511 | |
512 =over | |
513 | |
514 =item C<$paramDef> | |
515 | |
516 Описание параметра, может быть C<IMPL::Transform> или простая строка. | |
517 | |
518 Если описание параметра - простая строка, то ее имя либо | |
519 | |
520 =over | |
521 | |
522 =item C<id> | |
523 | |
524 Идентификатор дочернего ресурса | |
525 | |
526 =item C<query> | |
527 | |
528 Объект C<CGI> текущего запроса | |
529 | |
530 =item C<action> | |
531 | |
532 Текущий запрос C<IMPL::Web::Application::Action> | |
533 | |
534 =item C<любое другое значение> | |
535 | |
536 Интерпретируется как параметр текущего запроса. | |
537 | |
538 =back | |
539 | |
540 Если описание параметра - объект C<IMPL::Transform>, то будет выполнено это преобразование над C<CGI> | |
541 объектом текущего запроса C<< $paramDef->Transform($action->query) >>. | |
542 | |
543 =back | |
544 | |
196 | 545 =cut |