Changeset 1242
- Timestamp:
- 01/16/08 14:31:44 (6 months ago)
- Files:
-
- trunk/config/xml/config.xml (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/session/stubPHPSession.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/session/stubSession.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/websites/xml/stubXMLProcessor.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/RegistryTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/config/xml/config.xml
r1219 r1242 3 3 xmlns:xj="http://xjconf.net/XJConf" 4 4 xmlns="http://stubbles.net/util/registry"> 5 <config name="net.stubbles.mode" value="test" />6 5 <config name="net.stubbles.language" value="en_EN" /> 7 6 <config name="net.stubbles.number.decimals" value="4" /> trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php
r1223 r1242 26 26 { 27 27 /** 28 * registry key for request class to be used 29 */ 30 const CLASS_REGISTRY_KEY = 'net.stubbles.ipo.request.class'; 31 /** 28 32 * name of event that will be triggered in case the request is cancelled 29 33 */ 30 const EVENT_CANCELLED = 'onRequestCancelled';34 const EVENT_CANCELLED = 'onRequestCancelled'; 31 35 /** 32 36 * request source: cookies 33 37 */ 34 const SOURCE_COOKIE = 1;38 const SOURCE_COOKIE = 1; 35 39 /** 36 40 * request source: header 37 41 */ 38 const SOURCE_HEADER = 2;42 const SOURCE_HEADER = 2; 39 43 /** 40 44 * request source: parameters 41 45 */ 42 const SOURCE_PARAM = 4;46 const SOURCE_PARAM = 4; 43 47 44 48 /** trunk/src/main/php/net/stubbles/ipo/session/stubPHPSession.php
r1223 r1242 50 50 protected function getFingerprint() 51 51 { 52 return $this->request->getFilteredValue(new stubMD5Filter('', stubRegistry::getConfig( 'net.stubbles.ipo.session.fingerprintSalt', '')), 'HTTP_USER_AGENT', stubRequest::SOURCE_HEADER);52 return $this->request->getFilteredValue(new stubMD5Filter('', stubRegistry::getConfig(stubSession::SALT_REGISTRY_KEY, '')), 'HTTP_USER_AGENT', stubRequest::SOURCE_HEADER); 53 53 } 54 54 trunk/src/main/php/net/stubbles/ipo/session/stubSession.php
r1232 r1242 19 19 * key to be associated with the start time of the session 20 20 */ 21 const START_TIME = '__stubbles_SessionStartTime';21 const START_TIME = '__stubbles_SessionStartTime'; 22 22 /** 23 23 * key to be associated with the token for the next request 24 24 */ 25 const NEXT_TOKEN = '__stubbles_SessionNextToken';25 const NEXT_TOKEN = '__stubbles_SessionNextToken'; 26 26 /** 27 27 * key to be associated with the fingerprint of the user 28 28 */ 29 const FINGERPRINT = '__stubbles_SessionFingerprint'; 29 const FINGERPRINT = '__stubbles_SessionFingerprint'; 30 /** 31 * registry key for session class to be used 32 */ 33 const CLASS_REGISTRY_KEY = 'net.stubbles.ipo.session.class'; 34 /** 35 * registry key for session fingerprint salt to be used 36 */ 37 const SALT_REGISTRY_KEY = 'net.stubbles.ipo.session.fingerprintSalt'; 38 /** 39 * registry key for session name to be used 40 */ 41 const NAME_REGISTRY_KEY = 'net.stubbles.ipo.session.name'; 30 42 /** 31 43 * default session name 32 44 */ 33 45 const DEFAULT_SESSION_NAME = 'PHPSESSID'; 34 46 35 47 /** 36 48 * checks whether session has been started trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r1231 r1242 86 86 protected function createInstances() 87 87 { 88 $fqClassName = stubRegistry::getConfig( 'net.stubbles.ipo.request.class', 'net::stubbles::ipo::request::stubWebRequest');88 $fqClassName = stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY, 'net::stubbles::ipo::request::stubWebRequest'); 89 89 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 90 90 if (class_exists($className, false) == false) { … … 94 94 $this->request = new $className(); 95 95 if (($this->request instanceof stubRequest) == false) { 96 throw new stubRuntimeException('Configured request class is not an instance of stubRequest.');96 throw new stubRuntimeException('Configured request class is not an instance of net::stubbles::ipo::request::stubRequest.'); 97 97 } 98 98 99 $fqClassName = stubRegistry::getConfig( 'net.stubbles.ipo.session.class', 'net::stubbles::ipo::session::stubPHPSession');99 $fqClassName = stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY, 'net::stubbles::ipo::session::stubPHPSession'); 100 100 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 101 101 if (class_exists($className, false) == false) { … … 103 103 } 104 104 105 $this->session = new $className($this->request, stubRegistry::getConfig( 'net.stubbles.ipo.session.name', stubSession::DEFAULT_SESSION_NAME));105 $this->session = new $className($this->request, stubRegistry::getConfig(stubSession::NAME_REGISTRY_KEY, stubSession::DEFAULT_SESSION_NAME)); 106 106 if (($this->session instanceof stubSession) == false) { 107 throw new stubRuntimeException('Configured session class is not an instance of stubSession.');107 throw new stubRuntimeException('Configured session class is not an instance of net::stubbles::ipo::session::stubSession.'); 108 108 } 109 109 trunk/src/main/php/net/stubbles/websites/xml/stubXMLProcessor.php
r1231 r1242 129 129 $xmlStreamWriter->writeStartElement('session'); 130 130 $xmlStreamWriter->writeElement('id', array(), $this->session->getId()); 131 $xmlStreamWriter->writeElement('name', array(), stubRegistry::getConfig( 'net.stubbles.ipo.session.name', stubSession::DEFAULT_SESSION_NAME));131 $xmlStreamWriter->writeElement('name', array(), stubRegistry::getConfig(stubSession::NAME_REGISTRY_KEY, stubSession::DEFAULT_SESSION_NAME)); 132 132 $xmlStreamWriter->writeElement('isNew', array(), (($this->session->isNew() == true) ? ('true') : ('false'))); 133 133 $xmlStreamWriter->writeStartElement('token'); trunk/src/test/php/net/stubbles/integration/RegistryTestCase.php
r1219 r1242 7 7 * @subpackage test_integration 8 8 */ 9 stubClassLoader::load('net::stubbles::util::stubRegistryXJConfInitializer'); 9 stubClassLoader::load('net::stubbles::util::stubRegistryXJConfInitializer', 10 'net::stubbles::ipo::request::stubRequest', 11 'net::stubbles::ipo::session::stubSession' 12 ); 10 13 /** 11 14 * Integration test for registry. … … 23 26 $registryInitializer = new stubRegistryXJConfInitializer(); 24 27 $registryInitializer->init(); 25 $this->assertEqual(stubRegistry::getConfig('net.stubbles.mode'), 'test');26 28 $this->assertEqual(stubRegistry::getConfig('net.stubbles.language'), 'en_EN'); 27 29 $this->assertEqual(stubRegistry::getConfig('net.stubbles.number.decimals'), 4); 28 30 $this->assertEqual(stubRegistry::getConfig('net.stubbles.util.log.class'), 'net::stubbles::util::log::stubBaseLogData'); 29 $this->assertEqual(stubRegistry::getConfig( 'net.stubbles.ipo.request.class'), 'net::stubbles::ipo::request::stubWebRequest');30 $this->assertEqual(stubRegistry::getConfig( 'net.stubbles.ipo.session.class'), 'net::stubbles::ipo::session::stubPHPSession');31 $this->assertEqual(stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY), 'net::stubbles::ipo::request::stubWebRequest'); 32 $this->assertEqual(stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY), 'net::stubbles::ipo::session::stubPHPSession'); 31 33 } 32 34 }
