annotate Lib/IMPL/Web/Application.pm @ 236:2904da230022

DOM refactoring
author sergey
date Mon, 15 Oct 2012 04:23:01 +0400
parents 3cebcf6fdb9b
children fe9d62d9054d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
1 package IMPL::Web::Application;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
4
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
5 use CGI;
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
6 use Carp qw(carp);
233
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
7 use IMPL::Const qw(:prop);
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
8
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
9 use IMPL::declare {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
10 require => {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
11 TAction => 'IMPL::Web::Application::Action',
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
12 HttpResponse => 'IMPL::Web::HttpResponse',
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
13 TFactory => '-IMPL::Object::Factory',
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
14 Exception => 'IMPL::Exception',
230
6d8092d8ce1b *reworked IMPL::Security
sergey
parents: 229
diff changeset
15 InvalidOperationException => '-IMPL::InvalidOperationException',
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
16 Loader => 'IMPL::Code::Loader'
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
17 },
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
18 base => [
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
19 'IMPL::Config' => '@_',
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
20 'IMPL::Object::Singleton' => '@_'
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
21 ],
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
22 props => [
233
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
23 actionFactory => PROP_RW,
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
24 handlers => PROP_RW | PROP_LIST,
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
25 security => PROP_RW,
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
26 options => PROP_RW,
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
27 fetchRequestMethod => PROP_RW,
3cebcf6fdb9b refactoring, cleaning code
sergey
parents: 230
diff changeset
28 output => PROP_RW
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
29 ]
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
30 };
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
31
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
32 sub CTOR {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
33 my ($this) = @_;
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
34
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
35 die IMPL::InvalidArgumentException->new( "handlers",
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
36 "At least one handler should be supplied" )
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
37 unless $this->handlers->Count;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
38
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
39 $this->actionFactory(TAction) unless $this->actionFactory;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
40 $this->fetchRequestMethod( \&defaultFetchRequest )
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
41 unless $this->fetchRequestMethod;
62
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
42 }
c64bd1bf727d Web application
wizard
parents: 60
diff changeset
43
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
44 sub Run {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
45 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
46
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
47 my $handler;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
48
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
49 $handler = _ChainHandler( $_, $handler ) foreach $this->handlers;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
50
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
51 while ( my $query = $this->FetchRequest() ) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
52
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
53 my $action = $this->actionFactory->new(
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
54 query => $query,
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
55 application => $this,
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
56 );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
57
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
58 eval {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
59 my $result = $handler->($action);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
60
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
61 die InvalidOperationException->new(
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
62 "Invalid handlers result. A reference to IMPL::Web::HttpResponse is expexted."
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
63 ) unless eval { $result->isa(HttpResponse) };
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
64
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
65 $result->PrintResponse( $this->output );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
66 };
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
67 if ($@) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
68 my $e = $@;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
69
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
70 HttpResponse->InternalError(
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
71 type => 'text/plain',
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
72 charset => 'utf-8',
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
73 body => $e
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
74 )->PrintResponse( $this->output );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
75
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
76 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
77 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
78 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
79
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
80 sub _ChainHandler {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
81 my ( $handler, $next ) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
82
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
83 if ( ref $handler eq 'CODE' ) {
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
84 return sub {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
85 my ($action) = @_;
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
86 return $handler->( $action, $next );
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
87 };
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
88 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
89 elsif ( eval { $handler->can('Invoke') } ) {
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
90 return sub {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
91 my ($action) = @_;
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
92 return $handler->Invoke( $action, $next );
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
93 };
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
94 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
95 elsif ( eval { $handler->isa(TFactory) } ) {
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
96 return sub {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
97 my ($action) = @_;
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
98 my $inst = $handler->new();
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
99 return $inst->Invoke( $action, $next );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
100 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
101 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
102 elsif ( $handler
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
103 and not ref $handler
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
104 and $handler =~ m/^(-)?(\w+(?:::\w+)*)$/ )
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
105 {
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
106 my $class = $2;
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
107 if ( not $1 ) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
108 Loader->safe->Require($class);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
109 die IMPL::InvalidArgumentException->(
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
110 "An invalid handler supplied", $handler
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
111 ) unless $class->can('Invoke');
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
112 }
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
113
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
114 return sub {
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
115 my ($action) = @_;
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
116 my $inst = $class->new();
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
117 return $inst->Invoke( $action, $next );
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
118 };
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
119 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
120 else {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
121 die new IMPL::InvalidArgumentException( "An invalid handler supplied",
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
122 $handler );
198
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
123 }
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
124 }
2ffe6f661605 Implemented IMPL::Web::Handler::RestController
cin
parents: 194
diff changeset
125
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
126 sub FetchRequest {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
127 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
128
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
129 if ( ref $this->fetchRequestMethod eq 'CODE' ) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
130 return $this->fetchRequestMethod->($this);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
131 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
132 else {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
133 die new IMPL::Exception(
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
134 "Unknown fetchRequestMethod type",
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
135 ref $this->fetchRequestMethod
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
136 );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
137 }
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
138 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
139
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
140 {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
141 my $hasFetched = 0;
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
142
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
143 sub defaultFetchRequest {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
144 my ($this) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
145 return undef if $hasFetched;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
146 $hasFetched = 1;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
147 $this->output(*STDOUT);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
148 my $query = CGIWrapper->new();
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
149 return $query;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
150 }
57
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
151 }
bf59ee1cd506 Web application main class functionality
wizard
parents: 52
diff changeset
152
213
sergey
parents: 198
diff changeset
153 sub defaultErrorHandler {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
154 my ( $this, $action, $e ) = @_;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
155 warn $e;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
156 if ( eval { $action->ReinitResponse(); 1; } ) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
157 $action->response->contentType('text/plain');
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
158 $action->response->charset( $this->responseCharset );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
159 $action->response->status(500);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
160 my $hout = $action->response->streamBody;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
161 print $hout $e;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
162 $action->response->Complete();
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
163 }
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
164 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents: 73
diff changeset
165
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
166 package CGIWrapper;
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 138
diff changeset
167 use parent qw(CGI);
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
168
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
169 use Encode;
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
170
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
171 our $NO_DECODE = 0;
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
172
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
173 sub param {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
174 my $this = shift;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
175
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
176 return $this->SUPER::param(@_) if $NO_DECODE;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
177
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
178 if (wantarray) {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
179 my @result = $this->SUPER::param(@_);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
180
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
181 return map Encode::is_utf8($_)
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
182 ? $_
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
183 : Encode::decode( $this->charset, $_, Encode::LEAVE_SRC ), @result;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
184 }
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
185 else {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
186 my $result = $this->SUPER::param(@_);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
187
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
188 return Encode::is_utf8($result)
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
189 ? $result
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
190 : Encode::decode( $this->charset, $result, Encode::LEAVE_SRC );
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
191 }
130
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
192
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
193 }
06a34c197b05 Added support for utf-8 and old versions of CGI module
wizard
parents: 129
diff changeset
194
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
195 sub upload {
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
196 my $this = shift;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
197
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
198 local $NO_DECODE = 1;
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
199 my $oldCharset = $this->charset();
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
200 $this->charset('ISO-8859-1');
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
201
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
202 my $fh = $this->SUPER::upload(@_);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
203
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
204 $this->charset($oldCharset);
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
205 return $fh;
138
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
206 }
c5bc900eefd3 IMPL::Web::Application: Fixed file uploading
wizard
parents: 130
diff changeset
207
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
208 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
209
52
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
210 __END__
15d720913562 security in work
wizard@linux-odin.local
parents: 49
diff changeset
211
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
212 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
213
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
214 =head1 NAME
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
215
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
216 C<IMPL::Web::Application> Класс для создания экземпляров приложения
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
217
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
218 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
219
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
220 =begin code
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
221
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
222 use IMPL::require {
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
223 App => 'IMPL::Web::Application'
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
224 };
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
225
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
226 my $instance = App->spawn(); # will use ./IMPL/Web/Application.xml as configuration
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
227
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
228 $instance->Run;
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
229
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
230 =end code
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
231
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
232 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
233
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
234 Создает экземпляр объекта, который получает и обрабатывает C<HTTP> запрос.
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
235 Приложение можно загрузить из C<xml> файла в котором описано состояние свойств,
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
236 для этого используется механизм C<IMPL::Serialization>.
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
237
229
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
238 Приложение представлет собой модульную конструкцию, которая состоит из цепочки
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
239 обработчиков. Цепочка обработчиков вызывается снизу вверх, при этом каждый
47f77e6409f7 heavily reworked the resource model of the web application:
sergey
parents: 213
diff changeset
240 обработчик самостоятельно рекурсивно вызывает следующий (более высокого уровня).
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
241
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 47
diff changeset
242 =cut