Changeset 1248

Show
Ignore:
Timestamp:
01/16/08 18:00:58 (6 months ago)
Author:
mikey
Message:

added support for forceSSL page property

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php

    r1237 r1248  
    7575     * This method only dispatches the request to different methods. 
    7676     */ 
    77     public function doProcess() 
     77    public function process() 
    7878    { 
    7979        $this->loadServiceConfig($this->getServiceFilePath()); 
     
    9696            $this->processGetRequest(); 
    9797        } 
     98         
     99        return $this; 
    98100    } 
    99101 
  • trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisProcessor.php

    r1247 r1248  
    1515                      'net::stubbles::util::validators::stubPreSelectValidator', 
    1616                      'net::stubbles::websites::cache::stubCachableProcessor', 
    17                       'net::stubbles::websites::processors::stubAbstractProcessor', 
     17                      'net::stubbles::websites::processors::stubAbstractPageProcessor', 
    1818                      'net::stubbles::websites::memphis::stubMemphisConfig', 
    1919                      'net::stubbles::websites::memphis::stubMemphisTemplate' 
     
    2525 * @subpackage  websites_memphis 
    2626 */ 
    27 class stubMemphisProcessor extends stubAbstractProcessor implements stubCachableProcessor 
     27class stubMemphisProcessor extends stubAbstractPageProcessor implements stubCachableProcessor 
    2828{ 
    2929    /** 
     
    9999    /** 
    100100     * does the real processing 
    101      */ 
    102     protected function doProcess() 
    103     { 
    104         $pageName      = $this->getPageName(); 
    105         $page          = $this->pageFactory->getPage($pageName); 
     101     * 
     102     * @param  stubPage  $page      the page to process 
     103     * @param  string    $pageName  name of the page to process 
     104     */ 
     105    protected function doProcess(stubPage $page, $pageName) 
     106    { 
    106107        $elements      = $page->getElements(); 
    107108        $prefixRequest = new stubRequestPrefixDecorator($this->request, ''); 
  • trunk/src/main/php/net/stubbles/websites/processors/stubAbstractProcessor.php

    r1247 r1248  
    110110 
    111111    /** 
    112      * processes the request 
    113      * 
    114      * @return  stubProcessor 
    115      */ 
    116     public function process() 
    117     { 
    118         $this->doProcess(); 
    119         return $this; 
    120     } 
    121  
    122     /** 
    123      * does the real processing 
    124      */ 
    125     protected abstract function doProcess(); 
    126  
    127     /** 
    128112     * returns the created response 
    129113     * 
     
    134118        return $this->response; 
    135119    } 
    136  
    137     /** 
    138      * retrieves the page name 
    139      * 
    140      * @param   string  $dirPrefix  directory prefix to use for page factory 
    141      * @return  string 
    142      */ 
    143     protected function getPageName($dirPrefix = null) 
    144     { 
    145         if (null != $dirPrefix) { 
    146             $dirPrefix .= DIRECTORY_SEPARATOR; 
    147         } 
    148          
    149         if ($this->request->hasValue('page') == true) { 
    150             $pageName = $this->request->getValidatedValue(new stubRegexValidator('/([a-zA-Z0-9_])/'), 'page'); 
    151             if (null == $pageName || $this->pageFactory->hasPage($dirPrefix . $pageName) == false) { 
    152                 $pageName = 'index'; 
    153             } 
    154         } else { 
    155             $pageName = 'index'; 
    156         } 
    157          
    158         $this->session->putValue('net.stubbles.websites.lastPage', $pageName); 
    159         return $pageName; 
    160     } 
    161120} 
    162121?> 
  • trunk/src/main/php/net/stubbles/websites/rasmus/stubRasmusProcessor.php

    r1231 r1248  
    77 * @subpackage  websites_rasmus 
    88 */ 
    9 stubClassLoader::load('net::stubbles::websites::processors::stubAbstractProcessor'); 
     9stubClassLoader::load('net::stubbles::websites::processors::stubAbstractPageProcessor'); 
    1010/** 
    1111 * Processor for rasmus pages. 
     
    1414 * @subpackage  websites_rasmus 
    1515 */ 
    16 class stubRasmusProcessor extends stubAbstractProcessor 
     16class stubRasmusProcessor extends stubAbstractPageProcessor 
    1717{ 
    1818    /** 
    1919     * does the real processing 
     20     * 
     21     * @param  stubPage  $page      the page to process 
     22     * @param  string    $pageName  name of the page to process 
    2023     */ 
    21     protected function doProcess(
     24    protected function doProcess(stubPage $page, $pageName
    2225    { 
    23         $pageName = $this->getPage(); 
    24         try { 
    25             $page = $this->pageFactory->getPage($pageName); 
    26         } catch (stubPageConfigurationException $pce) { 
    27             $this->response->replaceData((string) $pce); 
    28             return; 
    29         } 
    30  
    3126        $page->render($this->request, $this->session, $this->response); 
    3227        $this->response->addHeader('X-Generator', 'Rasmus\' Template Engine :-) powered by Stubbles, http://stubbles.net/'); 
  • trunk/src/main/php/net/stubbles/websites/xml/stubXMLProcessor.php

    r1242 r1248  
    88 * @subpackage  websites_xml 
    99 */ 
    10 stubClassLoader::load('net::stubbles::websites::processors::stubAbstractProcessor', 
     10stubClassLoader::load('net::stubbles::websites::processors::stubAbstractPageProcessor', 
    1111                      'net::stubbles::websites::xml::stubXMLResponse', 
    1212                      'net::stubbles::ipo::request::stubRequestPrefixDecorator', 
     
    2222 * @subpackage  websites_xml 
    2323 */ 
    24 class stubXMLProcessor extends stubAbstractProcessor 
     24class stubXMLProcessor extends stubAbstractPageProcessor 
    2525{ 
    2626    /** 
     
    3636        $response = new stubXMLResponse($response); 
    3737        parent::__construct($request, $session, $response, $pageFactory); 
     38        $this->pageDirPrefix = 'conf/'; 
    3839    } 
    3940 
    4041    /** 
    4142     * does the real processing 
    42      */ 
    43     protected function doProcess() 
     43     * 
     44     * @param  stubPage  $page      the page to process 
     45     * @param  string    $pageName  name of the page to process 
     46     */ 
     47    protected function doProcess(stubPage $page, $pageName) 
    4448    { 
    4549        $pageName        = $this->getPageName('conf'); 
    4650        $xmlSerializer   = $this->createXMLSerializer(); 
    4751        $xmlStreamWriter = $this->createXMLStreamWriter(); 
    48         $page            = $this->pageFactory->getPage('conf/' . $pageName); 
    49         $page->setProperty('name', $pageName); 
    5052        $this->response->setPage($page); 
    5153        $elements        = $page->getElements(); 
  • trunk/src/main/php/org/stubbles/test/BarProcessor.php

    r1221 r1248  
    1919     * does the real processing 
    2020     */ 
    21     protected function doProcess() 
     21    public function process() 
    2222    { 
    2323        // nothing to process here 
  • trunk/src/main/php/org/stubbles/test/FooProcessor.php

    r1221 r1248  
    1919     * does the real processing 
    2020     */ 
    21     protected function doProcess() 
     21    public function process() 
    2222    { 
    2323        // nothing to process here 
  • trunk/src/test/php/net/stubbles/websites/memphis/stubMemphisProcessorTestCase.php

    r1247 r1248  
    172172     * helper method to call protected method doProcess() 
    173173     */ 
    174     public function callDoProcess(
    175     { 
    176         $this->doProcess(); 
     174    public function callDoProcess($page, $pageName
     175    { 
     176        $this->doProcess($page, $pageName); 
    177177    } 
    178178} 
     
    275275        $this->mockResponse->expectNever('getData'); 
    276276        $this->mockResponse->expectNever('replaceData'); 
    277         $memphisProcessor->callDoProcess(); 
     277        $memphisProcessor->callDoProcess($this->mockPage, 'foo'); 
    278278    } 
    279279 
     
    307307        $this->mockSession->setReturnValue('getName', 'name'); 
    308308        $this->mockResponse->expectOnce('replaceData', array('name=idnameid')); 
    309         $memphisProcessor->callDoProcess(); 
     309        $memphisProcessor->callDoProcess($this->mockPage, 'foo'); 
    310310    } 
    311311 
     
    338338        $this->mockSession->setReturnValue('getName', 'name'); 
    339339        $this->mockResponse->expectOnce('replaceData', array('name=idnameid')); 
    340         $memphisProcessor->callDoProcess(); 
     340        $memphisProcessor->callDoProcess($this->mockPage, 'foo'); 
    341341    } 
    342342 
     
    366366        $this->mockResponse->expectNever('getData'); 
    367367        $this->mockResponse->expectNever('replaceData'); 
    368         $memphisProcessor->callDoProcess(); 
     368        $memphisProcessor->callDoProcess($this->mockPage, 'foo'); 
    369369    } 
    370370