annotate Lib/IMPL/Web/Application/RestResource.pm @ 201:0c018a247c8a

Reworked REST resource classes to be more transparent and intuitive
author sergey
date Tue, 24 Apr 2012 19:52:07 +0400
parents a9dbe534d236
children 5146e17a7b76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
1 package IMPL::Web::Application::RestResource;
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
2 use strict;
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
3
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
4 use IMPL::lang qw(:declare :constants is);
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
5 use IMPL::Exception();
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
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
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
9 ForbiddenException => 'IMPL::Web::ForbiddenException',
200
sergey
parents: 199
diff changeset
10 NotFoundException => 'IMPL::Web::NotFoundException',
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
11 InvalidOpException => '-IMPL::InvalidOperationException',
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
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
sergey
parents: 199
diff changeset
14 TResolve => '-IMPL::Config::Resolve',
sergey
parents: 199
diff changeset
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 => {
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
18 'IMPL::Web::Application::RestCustomResource' => '@_'
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;
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
24 public property index => PROP_GET | PROP_OWNERSET;
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
25 public property fetch => PROP_GET | PROP_OWNERSET;
200
sergey
parents: 199
diff changeset
26
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
27 public property methods => PROP_GET | PROP_OWNERSET;
200
sergey
parents: 199
diff changeset
28
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
29 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
30 public property enableForms => PROP_GET | PROP_OWNERSET;
200
sergey
parents: 199
diff changeset
31
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
32 }
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
33
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
34 sub CTOR {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
35 my ($this) = @_;
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
36
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
37 die ArgumentException->new("target") unless $this->target;
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
38
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
39 $this->final($this->childRegex ? 0 : 1);
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
40
200
sergey
parents: 199
diff changeset
41 if ($this->enableForms) {
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
42 $this->methods->{create} = {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
43 get => \&_ParentGet,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
44 post => \&_ParentPost,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
45 final => 1 # this resource doesn't have any children
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
46 };
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
47
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
48 $this->methods->{edit} = {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
49 get => \&_ParentGet,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
50 post => \&_ParentPut,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
51 final => 1 # this resource doesn't have any children
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
52 };
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
53
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
54 $this->methods->{delete} {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
55 get => \&_ParentGet,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
56 post => \&_ParentDelete
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
57 final => 1 # this resource doesn't have any children
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
58 }
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
59 }
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
60 }
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
61
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
62 sub _ParentGet {
200
sergey
parents: 199
diff changeset
63 my ($this,$action) = @_;
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
64 return $this->parent->GetImpl($action);
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
65 }
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
66
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
67 sub _ParentPut {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
68 my ($this,$action) = @_;
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
69 return $this->parent->PutImpl($action);
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
70 }
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
71
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
72 sub _ParentPost {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
73 my ($this,$action) = @_;
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
74 return $this->parent->PostImpl($action);
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
75 }
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
76
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
77 sub _ParentDelete {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
78 my ($this,$action) = @_;
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
79 return $this->parent->DeleteImpl($action);
200
sergey
parents: 199
diff changeset
80 }
sergey
parents: 199
diff changeset
81
sergey
parents: 199
diff changeset
82 sub FetchChildResource {
sergey
parents: 199
diff changeset
83 my ($this,$id,$action) = @_;
sergey
parents: 199
diff changeset
84
sergey
parents: 199
diff changeset
85 my $rx = $this->childRegex;
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
86
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
87 my $res;
200
sergey
parents: 199
diff changeset
88
sergey
parents: 199
diff changeset
89 if (length $id == 0) {
sergey
parents: 199
diff changeset
90
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
91 my $method = $this->index;
200
sergey
parents: 199
diff changeset
92 die ForbiddenException->new() unless $method;
sergey
parents: 199
diff changeset
93
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
94 $res = $this->InvokeMember($method,$action);
200
sergey
parents: 199
diff changeset
95
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
96 } elsif (my $resource = $this->methods->{$id}) {
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
97 return CustomResource->new(
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
98 get => $resource->{get},
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
99 post => $resource->{post},
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
100 put => $resource->{put},
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
101 delete => $resource->{delete},
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
102 parent => $this,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
103 id => $id,
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
104 target => $this->target
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
105 );
200
sergey
parents: 199
diff changeset
106
sergey
parents: 199
diff changeset
107 } elsif ($rx and $id =~ m/^$rx$/ and $method = $this->fetch) {
201
0c018a247c8a Reworked REST resource classes to be more transparent and intuitive
sergey
parents: 200
diff changeset
108 $res = $this->InvokeMember($method,$action, { id => $id } );
200
sergey
parents: 199
diff changeset
109 } else {
sergey
parents: 199
diff changeset
110 die ForbiddenException->new();
sergey
parents: 199
diff changeset
111 }
sergey
parents: 199
diff changeset
112
sergey
parents: 199
diff changeset
113 die NotFoundException->new() unless defined $res;
sergey
parents: 199
diff changeset
114
sergey
parents: 199
diff changeset
115 return $this->contract->Transform($res, {parent => $this, id => $id} );
sergey
parents: 199
diff changeset
116 }
sergey
parents: 199
diff changeset
117
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
118 1;
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
119
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
120 __END__
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
121
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
122 =pod
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
123
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
124 =head1 NAME
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
125
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
126 C<IMPL::Web::Application::RestResource> - ресурс Rest вебсервиса.
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
127
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
128 =head1 SYNOPSIS
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
129
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
130 =begin text
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
131
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
132 [REQUEST]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
133 GET /artists
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
134
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
135 [RESPONSE]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
136 <artists>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
137 <artist id="1">
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
138 <name>The Beatles <name/>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
139 </atrist>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
140 <artist id="2">
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
141 <name>Bonobo</name>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
142 </artist>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
143 </artists>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
144
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
145 [REQUEST]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
146 GET /artists/1/cds?title='Live at BBC'
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
147
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
148 [RESPONSE]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
149 <cds>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
150 <cd id="14">
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
151 <title>Live at BBC 1</title>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
152 </cd>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
153 <cd id="15">
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
154 <title>Live at BBC 2</title>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
155 </cd>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
156 </cds>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
157
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
158 [REQUEST]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
159 GET /cds/15
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
160
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
161 [RESPONSE]
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
162 <cd id="15">
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
163 <title>Live at BBC 2</title>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
164 </cd>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
165
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
166 =end text
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
167
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
168 =begin code
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
169
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
170 use IMPL::require {
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
171 TRes => 'IMPL::Web:Application::RestResource',
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
172 DataContext => 'My::App::DataContext'
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
173 };
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
174
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
175 my $cds = TRes->new(
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
176 DataContext->Default,
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
177 {
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
178 methods => {
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
179 history => {
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
180 get => {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
181 method => 'GetHistory',
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
182 parameters => [qw(from to)]
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
183 },
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
184 },
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
185 rating => {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
186 get => {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
187 method => 'GetRating'
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
188 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
189 post => {
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
190 method => 'Vote',
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
191 parameters => [qw(id rating comment)]
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
192 }
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
193 }
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
194 }
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
195 list => 'search',
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
196 fetch => 'GetItemById'
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
197 }
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
198 );
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
199
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
200 =end code
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
201
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
202 =head1 DESCRIPTION
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
203
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
204 Каждый ресурс представляет собой коллекцию и реализует методы C<HTTP> C<GET,POST,PUT,DELETE>.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
205
200
sergey
parents: 199
diff changeset
206 Ресурсы выстраиваются в иерархию, на основе пути. Поиск конечного реурса происходит последовательным
sergey
parents: 199
diff changeset
207 вызовом метода GET с именем очередного ресурса.
sergey
parents: 199
diff changeset
208
sergey
parents: 199
diff changeset
209
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
210 =head2 HTTP METHODS
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
211
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
212 =head3 C<GET>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
213
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
214 Возвращает коллекцию дочерних ресурсов.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
215
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
216 =head3 C<GET {id}>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
217
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
218 Возвращает дочерний объект с идентификатором C<id>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
219
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
220 =head3 C<GET {method}>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
221
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
222 Вызывает метод C<method> и возвращает его результаты. При публикации методов доступных
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
223 через C<GET> данные методы не должны вносить изменений в предметную область.
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 =head3 C<PUT {id}>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
226
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
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
229 =head3 C<DELETE {id}>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
230
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
231 Удаляет дочерний ресурс с указанным идентификатором.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
232
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
233 =head3 C<POST>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
234
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
235 Добавляет новый дочерний ресурс в коллекцию.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
236
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
237 =head3 C<POST {method}>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
238
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
239 Вызывает метод C<method>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
240
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
241 =head2 HTTP METHOD MAPPING
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
242
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
243 =head3 C<POST {method}>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
244
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
245 Вызывает метод C<method>, в отличии от C<GET> методы опубликованные через C<POST> могут вносить
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
246 изменения в объекты.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
247
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
248 =head1 BROWSER COMPATIBILITY
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
249
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
250 Однако существует проблема с браузерами, поскольку тег C<< <form> >> реализет только методы
200
sergey
parents: 199
diff changeset
251 C<GET,POST>. Для решения данной проблемы используется режим совместимости C<enableForms>. В
sergey
parents: 199
diff changeset
252 случае когда данный режим активен, автоматически публикуются дочерние ресурсы C<create,edit,delete>.
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
253
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
254 =head2 C<GET create>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
255
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
256 Возвращает C<target>.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
257
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
258 =head2 C<POST create>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
259
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
260 Вызывает метод C<PostImpl> передавая ему свои параметры.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
261
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
262 =head2 C<GET edit>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
263
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
264 Возвращает C<target>.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
265
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
266 =head2 C<POST edit>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
267
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
268 Вызывает метод C<$this->parent->PutImpl($this->id)> передавая ему свои параметры.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
269
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
270 =head2 C<GET delete>.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
271
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
272 Возвращает C<target>.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
273
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
274 =head2 C<POST delete>.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
275
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
276 Вызывает метод C<$this->parent->DeleteImpl($this->id)> передавая ему свои параметры.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
277
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
278 =head1 MEMBERS
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
279
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
280 =head2 C<[get]id>
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 Идентификатор текущего ресурса.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
283
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
284 =head2 C<[get]target>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
285
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
286 Объект (также может быть и класс), обеспечивающий функционал ресурса.
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
287
199
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
288 =head2 C<[get]parent>
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
289
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
290 Родительский ресурс, в котором находится текущий ресурс. Может быть C<undef>,
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
291 если текущий ресурс является корнем.
e743a8481327 Added REST support for forms (with only get and post methods)
sergey
parents: 198
diff changeset
292
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
293 =head2 C<[get]methods>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
294
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
295 Содержит описания методов, которые будут публиковаться как дочерние ресурсы.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
296
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
297 =head2 C<[get]childRegex>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
298
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
299 Содержит регулярное выражение для идентификаторов дочерних объектов. Если оно
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
300 не задано, то данный ресурс не является коллекцией.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
301
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
302 =head2 C<[get]fetch>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
303
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
304 Содержит описание метода для получения дочернего объекта. Если данный метод
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
305 отсутствует, то дочерние ресурсы не получится адресовать относительно данного.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
306 По умолчанию получает идентификатор дочернего ресурса первым параметром.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
307
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
308 =head2 C<[get]list>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
309
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
310 Описание метода для получения списка дочерних объектов. По умолчанию не
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
311 получает параметров.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
312
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
313 =head2 C<[get]insert>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
314
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
315 Описание метода для добавление дочернего ресурса. По умолчанию получает
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
316 объект C<CGI> описывабщий текущий запрос первым параметром.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
317
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
318 =head2 C<[get]update>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
319
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
320 Описание метода для обновления дочернего ресурса. По умолчанию получает
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
321 идентификатор дочернего ресурса и объект C<CGI> текущего запроса.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
322
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
323 =head2 C<[get]delete>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
324
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
325 Описание метода для удаления дочернего ресурса. По умолчанию получает
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
326 идентификатор дочернего ресурса.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
327
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
328 =head2 C<GetImpl($child,$action)>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
329
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
330 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
331
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
332 =item C<$child>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
333
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
334 Идентификатор дочернего ресутсра
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
335
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
336 =item C<$action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
337
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
338 Текущий запрос C<IMPL::Web::Application::Action>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
339
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
340 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
341
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
342 Переадресует запрос нужному методу внутреннего объекта C<target> при
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
343 помощи C<InvokeMember>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
344
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
345 =head2 C<PutImpl($child,$action)>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
346
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
347 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
348
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
349 =item C<$child>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
350
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
351 Идентификатор дочернего ресутсра
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
352
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
353 =item C<$action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
354
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
355 Текущий запрос C<IMPL::Web::Application::Action>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
356
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
357 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
358
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
359 Переадресует запрос нужному методу внутреннего объекта C<target> при
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
360 помощи C<InvokeMember>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
361
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
362 =head2 C<PostImpl($child,$action)>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
363
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
364 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
365
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
366 =item C<$child>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
367
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
368 Идентификатор дочернего ресутсра
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
369
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
370 =item C<$action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
371
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
372 Текущий запрос C<IMPL::Web::Application::Action>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
373
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
374 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
375
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
376 Переадресует запрос нужному методу внутреннего объекта C<target> при
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
377 помощи C<InvokeMember>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
378
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
379 =head2 C<DeleteImpl($child,$action)>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
380
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
381 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
382
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
383 =item C<$child>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
384
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
385 Идентификатор дочернего ресутсра
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
386
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
387 =item C<$action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
388
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
389 Текущий запрос C<IMPL::Web::Application::Action>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
390
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
391 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
392
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
393 Переадресует запрос нужному методу внутреннего объекта C<target> при
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
394 помощи C<InvokeMember>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
395
197
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
396 =head2 C<InvokeMember($memberInfo,$child,$action)>
6b1dda998839 Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents: 196
diff changeset
397
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
398 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
399
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
400 =item C<$memberInfo>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
401
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
402 Описание члена внутреннего объекта C<target>, который нужно вызвать.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
403
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
404 =item C<$child>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
405
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
406 Идентификатор дочернего ресутсра
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
407
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
408 =item C<$action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
409
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
410 Текущий запрос C<IMPL::Web::Application::Action>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
411
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
412 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
413
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
414 Вызывает метод внутреннего объекта C<target>, предварительно подготовив
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
415 параметры на основе описания C<$memberInfo> и при помощи С<MakeParameter()>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
416
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
417 =head2 C<MakeParameter($paramDef,$child,$action)>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
418
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
419 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
420
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
421 =item C<$paramDef>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
422
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
423 Описание параметра, может быть C<IMPL::Transform> или простая строка.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
424
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
425 Если описание параметра - простая строка, то ее имя либо
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
426
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
427 =over
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
428
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
429 =item C<id>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
430
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
431 Идентификатор дочернего ресурса
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
432
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
433 =item C<query>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
434
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
435 Объект C<CGI> текущего запроса
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
436
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
437 =item C<action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
438
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
439 Текущий запрос C<IMPL::Web::Application::Action>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
440
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
441 =item C<любое другое значение>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
442
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
443 Интерпретируется как параметр текущего запроса.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
444
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
445 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
446
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
447 Если описание параметра - объект C<IMPL::Transform>, то будет выполнено это преобразование над C<CGI>
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
448 объектом текущего запроса C<< $paramDef->Transform($action->query) >>.
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
449
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
450 =back
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 197
diff changeset
451
196
a705e848dcc7 added IMPL::Config::Reference
cin
parents:
diff changeset
452 =cut