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