diff Lib/IMPL/Web/Application/Action.pm @ 65:2840c4c85db8

Application configuration improvements Documentation
author wizard
date Tue, 16 Mar 2010 17:36:13 +0300
parents 76b878ad6596
children 9f5795a10939
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/Action.pm	Mon Mar 15 17:45:13 2010 +0300
+++ b/Lib/IMPL/Web/Application/Action.pm	Tue Mar 16 17:36:13 2010 +0300
@@ -11,11 +11,17 @@
 	public property application => prop_get | owner_set;
 	public property query => prop_get | owner_set;
 	public property response => prop_get | owner_set;
+	public property responseFactory => prop_get | owner_set;
 	
 	private property _entryPoint => prop_all;
 }
 
-#todo: make ability to discard old and create new response
+sub CTOR {
+	my ($this) = @_;
+	
+	$this->responseFactory('IMPL::Web::Application::Response') unless $this->responseFactory; 
+	$this->response( $this->responseFactory->new(query => $this->query) );
+}
 
 sub Invoke {
 	my ($this) = @_;
@@ -27,6 +33,15 @@
 	}
 }
 
+sub ReinitResponse {
+	my ($this) = @_;
+	
+	die new IMPL::InvalidOperationException("Response already sent") if $this->response->isHeaderPrinted;
+	
+	$this->response->Discard;
+	$this->response($this->responseFactory->new(query => $this->query));
+}
+
 sub ChainHandler {
 	my ($this,$handler) = @_;