annotate Lib/IMPL/Web/Application/RestResource.pm @ 199:e743a8481327

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