annotate Lib/IMPL/Web/Application/Action.pm @ 229:47f77e6409f7

heavily reworked the resource model of the web application: *some ResourcesContraact functionality moved to Resource +Added CustomResource *Corrected action handlers
author sergey
date Sat, 29 Sep 2012 02:34:47 +0400
parents c8fe3f84feba
children 6d8092d8ce1b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
1 package IMPL::Web::Application::Action;
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
2 use strict;
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
3
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 149
diff changeset
4 use parent qw(IMPL::Object IMPL::Object::Autofill);
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
5
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
6 __PACKAGE__->PassThroughArgs;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
7
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
8 use IMPL::Class::Property;
206
c8fe3f84feba +IMPL::Web::Handlers::ViewSelector
sergey
parents: 194
diff changeset
9 use Carp qw(carp);
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
10
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
11 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
12 public property application => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
13 public property query => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14 private property _entryPoint => prop_all;
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
15 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
16
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
17 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
18 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
19
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 $this->context({});
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
21 }
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
22
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
23 sub Invoke {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
24 my ($this) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
25
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
26 if ($this->_entryPoint) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 $this->_entryPoint->();
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 die new IMPL::InvalidOperationException("At least one handler is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 }
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
31 }
609b59c9f03c Web application
wizard
parents: 52
diff changeset
32
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
33 sub cookie {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
35
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
36 $this->_launder(scalar( $this->query->cookie($name) ), $rx );
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
37 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
38
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
39 sub param {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
40 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
41
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
42 $this->_launder(scalar( $this->query->param($name) ), $rx );
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
43 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
44
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
45 sub requestMethod {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
46 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
47 return $this->query->request_method;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
48 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
49
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
50 sub pathInfo {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
51 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
52 return $this->query->path_info;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
53 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
54
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
55 sub _launder {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
56 my ($this,$value,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
57
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
58 if ( $value ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
59 if ($rx) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
60 if ( my @result = ($value =~ m/$rx/) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
61 return @result > 1 ? \@result : $result[0];
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
62 } else {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
63 return;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
64 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
65 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
66 return $value;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
67 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
68 } else {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
69 return;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70 }
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
71 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
72
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
73 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
74
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
75 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
76
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
77 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
78
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
79 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
80
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
81 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
82
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
83 =head1 DESCRIPTION
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
84
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
85 C<[Infrastructure]>
206
c8fe3f84feba +IMPL::Web::Handlers::ViewSelector
sergey
parents: 194
diff changeset
86 Свзяывет CGI запрос, приложение, орабатывающее его и ответ, который будет отправлен клиенту.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
87
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
88 =head1 MEMBERS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
89
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
90 =head2 C<CTOR(%args)>
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
91
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
92 Инициализирует новый экземпляр. Именованными параметрами передаются значения
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
93 свойств.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
94
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
95 =head2 C< [get]application>
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
96
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
97 Экземпляр приложения создавшего текущий объект
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
98
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
99 =item C< [get] query >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
100
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
101 Экземпляр C<CGI> запроса
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
102
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
103 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
104
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
105
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
106 =cut