annotate Lib/IMPL/Web/Application/Response.pm @ 67:9f5795a10939

Documentation, minor fixes
author wizard
date Fri, 19 Mar 2010 20:06:12 +0300
parents 2840c4c85db8
children 67eb8eaec3d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
59
0f3e369553bd Rewritten property implementation (probably become slower but more flexible)
wizard
parents: 58
diff changeset
1 package IMPL::Web::Application::Response;
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
2 use strict;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
3
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
4 use base qw(IMPL::Object IMPL::Object::Autofill);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
5
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
6 require IMPL::Exception;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
7 require CGI;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
8 require CGI::Cookie;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
9
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
10 use Carp;
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
11 use Encode;
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
12 use IMPL::Class::Property;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
13
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
14 #todo: add binary method to set a binary encoding, set it automatic when type isn't a text
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
15
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
16 BEGIN {
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
17 # автозаполнение буде происходить в порядке объявления
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
18 public property query => prop_get | owner_set; # cgi query
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
19 public property status => prop_all, { validator => \&_checkHeaderPrinted };
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
20 public property contentType => prop_all, { validator => \&_checkHeaderPrinted }; # String
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
21 public property charset => { get => \&_charset, set => \&_charset }, { validator => \&_checkHeaderPrinted };
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
22 public property expires => prop_all, { validator => \&_checkHeaderPrinted };
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
23 public property cookies => prop_all, { validator => \&_checkHeaderPrinted }; # Hash
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
24
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
25 public property buffered => prop_all, { validator => \&_canChangeBuffer }; # Boolean
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
26 public property streamOut => prop_get | owner_set; # stream
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
27 public property streamBody => {get => \&getStreamBody }; # stream
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
28 public property isHeaderPrinted => prop_get | owner_set; # Boolean
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
29
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
30 private property _bufferBody => prop_all;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
31 private property _streamBody => prop_all;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
32 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
33
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
34 __PACKAGE__->PassThroughArgs;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
35
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
36 our %CTOR = (
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
37 'IMPL::Object::Autofill' => sub {
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
38 my %args = @_;
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
39
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
40 $args{query} = CGI->new($args{query} || {});
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
41
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
42 %args;
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
43 }
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
44 );
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
45
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
46 sub CTOR {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
47 my ($this,%args) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
48
65
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
49 if (lc $this->streamOut eq 'memory') {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
50 my $dummy = '';
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
51 open my $hout, '>:encoding(utf8)', \$dummy or die new IMPL::Exception("Failed to create memory stream",$!);
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
52 $this->streamOut($hout);
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
53 } elsif (not $this->streamOut) {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
54 $this->streamOut(*STDOUT);
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
55 } else {
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
56 die new IMPL::InvalidArgumentException("Invalid parameter value",$this->streamOut);
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
57 }
2840c4c85db8 Application configuration improvements
wizard
parents: 63
diff changeset
58
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
59 $this->buffered(1) unless defined $this->buffered;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
60 binmode $this->streamOut, ":encoding(".$this->charset.")";
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
61 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
62
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
63 sub _checkHeaderPrinted {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
64 my ($this,$value) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
65
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
66 die new IMPL::InvalidOperationException() if $this->isHeaderPrinted;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
67 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
68
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
69 sub _canChangeBuffer {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
70 my ($this,$value) = @_;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
71
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
72 die new IMPL::InvalidOperationException() if $this->isHeaderPrinted or $this->_streamBody;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
73 }
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
74
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
75 sub _charset {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
76 my $this = shift;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
77
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
78 if (@_) {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
79 my $charset = $this->query->charset(@_);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
80
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
81 my $hout = $this->streamOut;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
82
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
83 binmode $hout;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
84 binmode $hout, ":encoding($charset)";
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
85
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
86 return $charset;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
87 } else {
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
88 return $this->query->charset;
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
89 }
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
90 }
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
91
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
92 sub _PrintHeader {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
93 my ($this) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
94
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
95 unless ($this->isHeaderPrinted) {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
96 $this->isHeaderPrinted(1);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
97
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
98 my %opt;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
99
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
100 $opt{-type} = $this->contentType if $this->contentType;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
101 $opt{-status} = $this->status if $this->status;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
102 $opt{-expires} = $this->expires if $this->expires;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
103
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
104 my $refCookies = $this->cookies;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
105 $opt{-cookie} = [map CGI::Cookie->new(-name => $_, $refCookies->{$_} ), keys %$refCookies] if $refCookies;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
106
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
107 my $hOut = $this->streamOut;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
108
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
109 print $hOut $this->query->header(
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
110 %opt
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
111 );
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
112 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
113 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
114
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
115 sub getStreamBody {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
116 my ($this) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
117
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
118 return undef unless $this->streamOut;
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
119
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
120 unless ($this->_streamBody) {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
121 if ($this->buffered) {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
122 my $buffer = "";
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
123
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
124 $this->_bufferBody(\$buffer);
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
125
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
126 open my $hBody, ">:encoding(utf-8)", \$buffer or die new IMPL::Exception("Failed to create buffer",$!);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
127
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
128 Encode::_utf8_on($buffer);
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
129
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
130 $this->_streamBody($hBody);
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
131 } else {
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
132 $this->_PrintHeader();
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
133 $this->_streamBody($this->streamOut);
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
134 }
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
135 }
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
136
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
137 return $this->_streamBody;
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
138 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
139
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
140 sub Complete {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
141 my ($this) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
142
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
143 return 0 unless $this->streamOut;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
144
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
145 my $hOut = $this->streamOut;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
146
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
147 $this->_PrintHeader();
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
148
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
149 $this->_streamBody(undef);
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
150
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
151 if ($this->buffered) {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
152 print $hOut ${$this->_bufferBody};
63
76b878ad6596 Added serialization support for the IMPL::Object::List
wizard
parents: 59
diff changeset
153 }
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
154
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
155 $this->_bufferBody(undef);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
156 $this->streamOut(undef);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
157
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
158 return 1;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
159 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
160
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
161 sub Discard {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
162 my ($this) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
163
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
164 carp "Discarding sent response" if $this->isHeaderPrinted;
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
165
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
166 $this->_streamBody(undef);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
167 $this->_bufferBody(undef);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
168 $this->streamOut(undef);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
169 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
170
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
171 1;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
172
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
173 __END__
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
174
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
175 =pod
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
176
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
177 =head1 NAME
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
178
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
179 C<IMPL::Web::Application::Response> - Ответ веб сервера непосредственно клиенту.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
180
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
181 =head1 DESCRIPTION
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
182
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
183 C<[Infrastructure]>
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
184
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
185 Позволяет сформировать основные свойства заголовка и тело ответа.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
186
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
187 Создается объектом C<IMPL::Web::Application::Action> в процессе обработки запроса.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
188
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
189 Может использоваться обработчиками C<IMPL::Web::QueryHandler> в процессе выполнения запроса.
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
190
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
191 Объект позволяет буфферизировать вывод в тело ответа, что позволяет отменить или изменить
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
192 ответ в последний момент. Свойство C< isHeaderPrinted > используется для определения факта
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
193 отправлки данных клиенту.
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
194
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
195 =head1 PROPERTIES
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
196
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
197 =head2 HTTP Header
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
198
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
199 Свойства отвечающие за заголовок HTTP ответа. Эти своства могут быть изменены до тех пор пока
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
200 не будет отправлен заголовок. В противном случае выдается исключение C< IMPL::InvalidOperationException >.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
201
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
202 =over
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
203
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
204 =item C< [get] query >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
205
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
206 CGI запрос, который используется для вывода данных, заголовка и пр. Существует всегда.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
207
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
208 =item C< [get,set] status >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
209
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
210 Код ошибки HTTP. Например, '200 OK'. По умолчанию не установлен, при отправке клиенту бедт отправлен '200 ОК'.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
211
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
212 =item C< [get,set] contentType >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
213
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
214 Тип MIME. По умолчанию не установлен, подразумивается 'text/html'.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
215
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
216 =item C< [get,set] charset >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
217
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
218 Кодировка, синоним свойства query->charset.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
219
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
220 =item C< [get,set] expires >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
221
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
222 Определяет время жизни контента, например '+10m'. По умолчанию не задано и не передается.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
223
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
224 =item C< [get,set] cookies >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
225
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
226 Хеш массив с cookies, например C< { cart => ['foo','bar'], display => 'list' } >.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
227
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
228 =back
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
229
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
230 =head2 Response behaviour
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
231
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
232 Свойства отвечающие за поведение ответа.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
233
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
234 =over
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
235
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
236 =item C< [get,set] buffered >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
237
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
238 C< True > - то тело ответа пишется в буффер и будет отправлено при вызове метода C< Complete >,
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
239 заголовок также будет отправлен после вызова метода C< Complete >.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
240
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
241 C< False > - тело ответа пишется непосредственно в поток к клиенту, при этом заголовок
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
242 будет отправлен при первом обращении к свойству C< streamBody >
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
243
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
244 Это свойство можно менять до первого обращения к потоку для записи в тело ответа.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
245
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
246 =item C< [get] streamOut >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
247
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
248 Стандартный вывод CGI приложения.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
249
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
250 =item C< [get] streamBody >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
251
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
252 Поток для записи в тело ответа.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
253
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
254 =item C< [get] isHeadPrinted >
58
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
255
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
256 Признак того, что заголовок уже был отправлен клиенту.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
257
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
258 =back
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
259
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
260 =head1 METHODS
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
261
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
262 =over
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
263
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
264 =item C< Complete >
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
265
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
266 Завершает отправку ответа.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
267
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
268 =item C< Discard >
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
269
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
270 Отменяет отправку ответа, при этом если часть данных (например, заголовок)
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
271 уже была отправлена, выдает предупреждение в STDERR.
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
272
a35b60b16a99 Configuration, late activation
wizard
parents: 57
diff changeset
273 =back
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
274
67
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
275 =head1 REMARKS
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
276
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
277 Данный объект является автозаполняемым, т.е. все его свойства можно задать через
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
278 именованные параметры конструктора.
9f5795a10939 Documentation, minor fixes
wizard
parents: 65
diff changeset
279
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
280 =cut