summaryrefslogtreecommitdiff
path: root/framework/TApplication.php
diff options
context:
space:
mode:
authorxue <>2005-12-01 16:33:16 +0000
committerxue <>2005-12-01 16:33:16 +0000
commit9b334afcd805d57834ca6504873f5efbb02d47fd (patch)
tree635c69c1e08a27f132b7127a81bf113036c47c0e /framework/TApplication.php
parent5d7149045a6fb6c40c0dbfb863e8b4fef3d9952f (diff)
Diffstat (limited to 'framework/TApplication.php')
-rw-r--r--framework/TApplication.php52
1 files changed, 34 insertions, 18 deletions
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
*/