annotate Lib/IMPL/Web/Application/Action.pm @ 245:7c517134c42f

Added Unsupported media type Web exception corrected resourceLocation setting in the resource Implemented localizable resources for text messages fixed TT view scopings, INIT block in controls now sets globals correctly.
author sergey
date Mon, 29 Oct 2012 03:15:22 +0400
parents a02b110da931
children 32aceba4ee6d
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
206
c8fe3f84feba +IMPL::Web::Handlers::ViewSelector
sergey
parents: 194
diff changeset
4 use Carp qw(carp);
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
5
238
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
6 use IMPL::Const qw(:prop);
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
7
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
8 use IMPL::declare {
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
9 base => [
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
10 'IMPL::Object' => undef,
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
11 'IMPL::Object::Autofill' => '@_'
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
12 ],
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
13 props => [
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
14 application => PROP_RO,
244
a02b110da931 refactoring
sergey
parents: 238
diff changeset
15 query => PROP_RO,
a02b110da931 refactoring
sergey
parents: 238
diff changeset
16 context => PROP_RW
238
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
17 ]
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
18 };
55
609b59c9f03c Web application
wizard
parents: 52
diff changeset
19
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
20 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 my ($this) = @_;
244
a02b110da931 refactoring
sergey
parents: 238
diff changeset
22
a02b110da931 refactoring
sergey
parents: 238
diff changeset
23 $this->context({});
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
24 }
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 62
diff changeset
25
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
26 sub cookie {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 $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
30 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
31
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
32 sub param {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33 my ($this,$name,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34
245
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
35 my $value;
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
36
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
37 if (
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
38 $this->requestMethod eq 'GET'
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
39 or
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
40 $this->query->content_type eq 'multipart/form-data'
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
41 or
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
42 $this->query->content_type eq 'application/x-www-form-urlencoded'
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
43 ) {
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
44 $value = scalar( $this->query->param($name) );
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
45 } else {
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
46 $value = scalar( $this->query->url_param($name) );
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
47 }
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
48
7c517134c42f Added Unsupported media type Web exception
sergey
parents: 244
diff changeset
49 $this->_launder($value, $rx );
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
50 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
51
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
52 sub requestMethod {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
53 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
54 return $this->query->request_method;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
55 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
56
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
57 sub pathInfo {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
58 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
59 return $this->query->path_info;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
60 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
61
238
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
62 sub baseUrl {
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
63 my ($this) = @_;
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
64
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
65 return $this->query->url(-base => 1);
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
66 }
b8c724f6de36 DOM model refactoring
sergey
parents: 230
diff changeset
67
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
68 sub _launder {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
69 my ($this,$value,$rx) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
71 if ( $value ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
72 if ($rx) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
73 if ( my @result = ($value =~ m/$rx/) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
74 return @result > 1 ? \@result : $result[0];
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
75 } else {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
76 return;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
77 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
78 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
79 return $value;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
80 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
81 } else {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
82 return;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
83 }
144
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
84 }
b56ebc31bf18 Empty nodes no more created while transforming a post request to the DOM document
wizard
parents: 67
diff changeset
85
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
86 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
87
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
88 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
89
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
90 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
91
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
92 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
93
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
94 C<IMPL::Web::Application::Action> - Обертка вокруг C<CGI> запроса.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
95
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
96 =head1 DESCRIPTION
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
97
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
98 C<[Infrastructure]>
206
c8fe3f84feba +IMPL::Web::Handlers::ViewSelector
sergey
parents: 194
diff changeset
99 Свзяывет CGI запрос, приложение, орабатывающее его и ответ, который будет отправлен клиенту.
52
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
100
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
101 =head1 MEMBERS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
102
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
103 =head2 C<CTOR(%args)>
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
104
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
105 Инициализирует новый экземпляр. Именованными параметрами передаются значения
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
106 свойств.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
107
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 206
diff changeset
108 =head2 C< [get]application>
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
109
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
110 Экземпляр приложения создавшего текущий объект
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
111
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
112 =item C< [get] query >
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
113
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
114 Экземпляр C<CGI> запроса
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
115
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
116 =back
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
117
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
118
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 173
diff changeset
119 =cut