Changeset 296 for tools

Show
Ignore:
Timestamp:
04/16/09 09:54:22 (11 months ago)
Author:
anton
Message:

Better URL parsing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tools/routingservice/branches/wrs-2.0/src/WRS.java

    r295 r296  
    256256                        } 
    257257                }; 
    258                 component.getDefaultHost().attach("/", restlet); 
     258                component.getDefaultHost().attach("/{version}/{profile}/{service}", restlet); 
    259259                component.start(); 
    260260 
     
    266266                        InvalidTemplateException 
    267267        { 
    268                 String url = req.getResourceRef().getRemainingPart().split("\\?")[0]; 
    269268                // http://<servicedomain>:<port>/<version>/<profile>/<service>.<format>?<input>={<data>} 
    270                 String urlSplit[] = url.split("/"); 
    271  
    272                 byte urlIndex = 0; 
    273                 String cVersion = urlSplit[urlIndex]; 
     269                 
     270                String cVersion = (String) req.getAttributes().get("version"); 
    274271 
    275272                if (!this.conf.getVersion().equals(cVersion)) 
     
    278275                } 
    279276 
    280                 // Next token (assumed to be profile name) 
    281                 ++urlIndex; 
    282  
    283                 String pName = urlSplit[urlIndex]; 
     277                String pName = (String) req.getAttributes().get("profile"); 
    284278                Profile cProfile = this.profiles.get(pName); 
    285279 
     
    289283                } 
    290284 
    291                 // Next token (assumed to be service.format) 
    292                 ++urlIndex; 
    293  
    294                 String sName = urlSplit[urlIndex].split("\\.")[0]; 
     285                String sName = ((String) req.getAttributes().get("service")).split("\\.")[0]; 
    295286                ArrayList csList = (ArrayList) cProfile.getServices().get(sName); 
    296287                // TODO implement a rule 
     
    302293                } 
    303294 
    304                 String tName = urlSplit[urlIndex].split("\\.")[1].split("\\?")[0]; 
     295                String tName = ((String) req.getAttributes().get("service")).split("\\.")[1]; 
     296 
    305297                Template cTemplate = cService.getTemplates().get(tName); 
    306298