comparison Lib/IMPL/Web/Application.pm @ 328:63709a4e6da0

Security framework refactoring
author cin
date Mon, 03 Jun 2013 03:28:01 +0400
parents 546957c50a36
children 97628101b765
comparison
equal deleted inserted replaced
327:6cb0d4d325d7 328:63709a4e6da0
24 props => [ 24 props => [
25 baseUrl => PROP_RW, 25 baseUrl => PROP_RW,
26 actionFactory => PROP_RW, 26 actionFactory => PROP_RW,
27 handlers => PROP_RW | PROP_LIST, 27 handlers => PROP_RW | PROP_LIST,
28 security => PROP_RW, 28 security => PROP_RW,
29 options => PROP_RW,
30 requestCharset => PROP_RW,
31 output => PROP_RW, 29 output => PROP_RW,
32 location => PROP_RO, 30 location => PROP_RO,
33 _handler => PROP_RW 31 _handler => PROP_RW
34 ] 32 ]
35 }; 33 };
61 59
62 my $action = $this->actionFactory->new( 60 my $action = $this->actionFactory->new(
63 query => $q, 61 query => $q,
64 application => $this, 62 application => $this,
65 ); 63 );
64
65 $this->BeforeProcessRequest($action);
66 66
67 eval { 67 eval {
68 my $result = $handler->($action); 68 my $result = $handler->($action);
69 69
70 die InvalidOperationException->new("Invalid handlers result. A reference to IMPL::Web::HttpResponse is expexted.") 70 die InvalidOperationException->new("Invalid handlers result. A reference to IMPL::Web::HttpResponse is expexted.")
71 unless eval { $result->isa(HttpResponse) }; 71 unless eval { $result->isa(HttpResponse) };
72 72
73 $result->PrintResponse( $this->output ); 73 $result->PrintResponse( $this->output );
74 }; 74 };
75
76 $this->AfterProcessRequest($action);
75 if ($@) { 77 if ($@) {
76 my $e = $@; 78 my $e = $@;
77 79
78 HttpResponse->InternalError( 80 HttpResponse->InternalError(
79 type => 'text/plain', 81 type => 'text/plain',
128 die new IMPL::InvalidArgumentException( "An invalid handler supplied", 130 die new IMPL::InvalidArgumentException( "An invalid handler supplied",
129 $handler ); 131 $handler );
130 } 132 }
131 } 133 }
132 134
135 sub BeforeProcessRequest {
136
137 }
138
139 sub AfterProcessRequest {
140
141 }
142
133 1; 143 1;
134 144
135 __END__ 145 __END__
136 146
137 =pod 147 =pod