Changeset 311
- Timestamp:
- 02/28/07 18:07:11 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r241 r311 8 8 */ 9 9 stubClassLoader::load('net.stubbles.stubFactory', 10 'net.stubbles.ioc.injection.injection', 11 'net.stubbles.ipo.request.stubWebRequest', 12 'net.stubbles.ipo.session.stubPHPSession', 13 'net.stubbles.util.stubRegistry', 10 14 'net.stubbles.util.xjconf.stubXJConfLoader' 11 15 ); … … 41 45 */ 42 46 protected $resolver; 47 /** 48 * the list of injections 49 * 50 * @var stubInjectionMap 51 */ 52 protected $injectionMap; 43 53 /** 44 54 * contains request data … … 83 93 throw new stubException($xjce->getMessage()); 84 94 } 95 $this->resolver = $xmlParser->getConfigValue('resolver'); 85 96 86 $this->resolver = $xmlParser->getConfigValue('resolver'); 97 $this->injectionMap = new stubInjectionMap(); 98 if (stubRegistry::hasConfig('net.stubbles.ipo.request.class') == true) { 99 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.request.class'); 100 stubClassLoader::load($fqClassName); 101 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 102 $request = new $className(); 103 if (($request instanceof stubRequest) == false) { 104 throw new stubException('Configured request class is not an instance of stubRequest.'); 105 } 106 107 $this->injectionMap->addInjection('stubRequest', $request); 108 } else { 109 $this->injectionMap->addInjection('stubRequest', new stubWebRequest()); 110 } 111 112 if (stubRegistry::hasConfig('net.stubbles.ipo.session.class') == true) { 113 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.session.class'); 114 stubClassLoader::load($fqClassName); 115 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 116 $session = new $className(); 117 if (($session instanceof stubSession) == false) { 118 throw new stubException('Configured session class is not an instance of stubSession.'); 119 } 120 121 $this->injectionMap->addInjection('stubSession', $session); 122 } else { 123 $this->injectionMap->addInjection('stubSession', new stubPHPSession()); 124 } 87 125 } 88 126 … … 93 131 { 94 132 foreach ($this->preInterceptors as $preInterceptor) { 95 #Inject::factory(array(), $preInterceptor);133 stubInjectAnnotation::factory($this->injectionMap, $preInterceptor); 96 134 $preInterceptor->preProcess(); 97 135 } … … 101 139 * processes all postinterceptors 102 140 */ 103 protected function tearDown( stubResponse $response)141 protected function tearDown() 104 142 { 105 143 foreach ($this->postInterceptors as $postInterceptor) { 106 #Inject::factory(array(), $postInterceptor);107 $postInterceptor->p reProcess();144 stubInjectAnnotation::factory($this->injectionMap, $postInterceptor); 145 $postInterceptor->postProcess(); 108 146 } 109 147 } … … 116 154 $this->startUp(); 117 155 $response = $this->resolver->resolve($this->request, $this->session)->process()->getResponse(); 118 $this->tearDown($response); 156 $this->injectionMap->addInjection('stubResponse', $response); 157 $this->tearDown(); 119 158 $response->send(); 120 159 }
