Changeset 2946 for TI05-delivery


Ignore:
Timestamp:
12/10/07 12:20:53 (12 years ago)
Author:
domlowe
Message:

wcs controller now redirects internally and invisibly to different controllers for each wcs version

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/routing.py

    r2925 r2946  
    2929    #wcs controller for all versions: (called wcsx) 
    3030    map.connect('wcs/:uri', controller='csml_wcsx') 
    31     #1.1.0 currently at "csml_wcs" controller 
    32     map.connect('wcs1_1_0/:uri', controller='csml_wcs1_1_0') # currently 1.1 
    33     #1.0.0  at "wcs1_0_0" 
    34     map.connect('wcs1_0_0/:uri', controller='csml_wcs1_0_0') # 1.0 plus  
     31 
    3532    #filestore - used for 'store' in wcs 
    3633    map.connect('filestore/:file', controller='fetch', action='fetchFile') 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wcsx.py

    r2930 r2946  
    1010from ows_server.lib.base import * 
    1111from ows_server.lib.decorators import * 
    12  
     12from ows_server.controllers import csml_wcs1_1_0, csml_wcs1_0_0 
     13import sys 
    1314 
    1415class CsmlWcsxController(OwsController): 
    1516    ''' Overarching version independent wcs controller that passes request to correct version of WCS controller (eg 1.0.0 or 1.1.1 etc) '''       
    16      
    17     def _getWCSurl(self,version): 
    18         ''' given a wcs request and version get the correct url to forward to'''         
     17        
     18    def _getWCSController(self): 
     19        ''' return the wcs controller that corresponds to the version requested 
     20        called from within the other methods, which have already performed validation on the version parameter ''' 
    1921         
    20         #check config to see if proxy is being used 
    21         try: 
    22             hostname=request.environ['paste.config']['app_conf']['proxyname'] 
    23         except: 
    24             hostname=hostname=request.environ['HTTP_HOST']                     
     22        if self.version == '1.0.0': 
     23            ctrl=csml_wcs1_0_0.CsmlWcs100Controller() 
     24            return ctrl(request.environ, self.start_response) 
     25        elif self.version == '1.1.0': 
     26            ctrl=csml_wcs1_1_0.CsmlWcs110Controller() 
     27            return ctrl(request.environ, self.start_response) 
    2528         
    26         #called from within the other methods, which have already performed validation on the version parameter 
    27         if version == '1.0.0': 
    28             v='/wcs1_0_0/' 
    29         elif version == '1.1.0': 
    30             v='/wcs1_1_0/' 
    31   
    32         #construct url 
    33         u='http://'+hostname+v+str(request.environ['pylons.routes_dict']['uri'])+'?'+request.environ['QUERY_STRING']                 
    34         return u 
    35      
    36      
     29         
    3730    @operation 
    3831    @parameter('Version', possibleValues=['1.0.0','1.1.0']) 
     
    4134        Use the right controller (correct version) to perform the getCapabilities operation 
    4235        """ 
    43         newurl=self._getWCSurl(version) 
    44         h.redirect_to(newurl) 
     36        self.version=version 
     37        return self._getWCSController() 
    4538             
    4639    @operation 
     
    5043        Use the right controller (correct version) to perform the DescribeCoverage operation 
    5144        """ 
    52         newurl=self._getWCSurl(version) 
    53         h.redirect_to(newurl) 
     45        self.version=version 
     46        return self._getWCSController() 
    5447         
    5548    @operation 
     
    5952        Use the right controller (correct version) to perform the GetCoverage operation 
    6053        """ 
    61         newurl=self._getWCSurl(version) 
    62         h.redirect_to(newurl) 
     54        self.version=version 
     55        return self._getWCSController() 
Note: See TracChangeset for help on using the changeset viewer.