From 9b334afcd805d57834ca6504873f5efbb02d47fd Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 1 Dec 2005 16:33:16 +0000 Subject: --- framework/TApplication.php | 52 ++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'framework/TApplication.php') diff --git a/framework/TApplication.php b/framework/TApplication.php index f4d8c124..bd8e8e39 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -220,7 +220,6 @@ class TApplication extends TComponent $this->_cacheFile=$cacheFile; // generates unique ID by hashing the configuration file path $this->_uniqueID=md5($this->_configFile); - $this->_errorHandler=new TErrorHandler; } /** @@ -363,6 +362,11 @@ class TApplication extends TComponent */ public function getRequest() { + if(!$this->_request) + { + $this->_request=new THttpRequest; + $this->_request->init($this,null); + } return $this->_request; } @@ -379,6 +383,11 @@ class TApplication extends TComponent */ public function getResponse() { + if(!$this->_response) + { + $this->_response=new THttpResponse; + $this->_response->init($this,null); + } return $this->_response; } @@ -391,35 +400,45 @@ class TApplication extends TComponent } /** - * @return TErrorHandler the error hanlder module + * @return THttpSession the session module, null if session module is not installed */ - public function getErrorHandler() + public function getSession() { - return $this->_errorHandler; + if(!$this->_session) + { + $this->_session=new THttpSession; + $this->_session->init($this,null); + } + return $this->_session; } /** - * @param TErrorHandler the error hanlder module + * @param THttpSession the session module */ - public function setErrorHandler(TErrorHandler $handler) + public function setSession(THttpSession $session) { - $this->_errorHandler=$handler; + $this->_session=$session; } /** - * @return THttpSession the session module, null if session module is not installed + * @return TErrorHandler the error hanlder module */ - public function getSession() + public function getErrorHandler() { - return $this->_session; + if(!$this->_errorHandler) + { + $this->_errorHandler=new TErrorHandler; + $this->_errorHandler->init($this,null); + } + return $this->_errorHandler; } /** - * @param THttpSession the session module + * @param TErrorHandler the error hanlder module */ - public function setSession(THttpSession $session) + public function setErrorHandler(TErrorHandler $handler) { - $this->_session=$session; + $this->_errorHandler=$handler; } /** @@ -559,7 +578,7 @@ class TApplication extends TComponent if($this->hasEventHandler('Error')) $this->raiseEvent('Error',$this,$param); else - $this->_errorHandler->handleError($this,$param); + $this->getErrorHandler()->handleError($this,$param); } /** @@ -724,10 +743,7 @@ class TApplicationConfiguration extends TComponent /** * @var array list of module configurations */ - private $_modules=array( - 'request'=>array('THttpRequest',array(),null), - 'response'=>array('THttpResponse',array(),null) - ); + private $_modules=array(); /** * @var array list of service configurations */ -- cgit v1.2.3