annotate Lib/IMPL/Web/Response.pm @ 54:f4e045e47770

commit
author wizard@linux-odin.local
date Tue, 02 Mar 2010 20:15:57 +0300
parents 15d720913562
children
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::Response;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
2
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
3 use base qw(IMPL::Object);
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
4
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
5 require IMPL::Exception;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
6
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
7 use IMPL::Class::Property;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
8 use HTTP::Response;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
9
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
10 BEGIN {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
11 public property request => prop_get; # cgi query
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
12 public property contentType => prop_all, { validator => \&_checkHeaderPrinted }; # String
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
13 public property buffered => prop_get; # Boolean
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
14 public property cookies => prop_all, { validator => \&_checkHeaderPrinted }; # Hash
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
15 public property streamBody => { get => \&getStreamBody }; # stream
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
16
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
17 private property _streamBody => prop_all; # stream
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
18 private property _streamOut => prop_all; # stream
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
19 private property _isHeaderPrinted => prop_all; # Boolean
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
20 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
21
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
22 sub _checkHeaderPrinted {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
23 my ($this,$value) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
24
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
25 die new IMPL::InvalidOperationException() if $this->_isHeaderPrinted;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
26 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
27
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
28 sub getStreamBody {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
29 my ($this) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
30
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
31 return $this->_streamBody if $this->buffered;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
32
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
33
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
34 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
35
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
36 sub _PrintHeader {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
37 my ($this) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
38
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
39 unless ($this->_isHeaderPrinted) {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
40 $this->_isHeaderPrinted(1);
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
41
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
42
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
43 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
44 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
45
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
46 sub Send {
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
47
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
48 }
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
49
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
50 1;
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
51
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
52 __END__
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
53
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
54 =pod
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
55
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
56
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
57
15d720913562 security in work
wizard@linux-odin.local
parents:
diff changeset
58 =cut