Changeset 1590

Show
Ignore:
Timestamp:
06/30/08 22:47:46 (6 months ago)
Author:
lmajano
Message:

convention variables for ses finalized.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/system/interceptors/ses.cfc

    r1589 r1590  
    154154                <cfset httpRequestData = GetHttpRequestData()/> 
    155155                 
     156                <!--- Only verify if unique URLS are on, we have an event and a valid empty course. ---> 
    156157                <cfif getUniqueURLs()  
    157158                          AND StructKeyExists(rc, EventName) 
    158159                          AND (arguments.course EQ "/index.cfm" or arguments.course eq "")> 
    159160                         
     161                        <!--- Clean for handler & Action ---> 
    160162                        <cfif StructKeyExists(rc, EventName)> 
    161163                                <cfset handler = reReplace(rc[EventName],"\.[^.]*$","") /> 
    162164                                <cfset action = ListLast( rc[EventName], "." ) /> 
    163165                        </cfif> 
    164                          
     166                        <!--- course a handler ---> 
    165167                        <cfif len(handler)> 
    166168                                <cfset newpath = "/" & handler /> 
    167169                        </cfif> 
    168                          
     170                        <!--- Course path with handler + action if not the default event action ---> 
    169171                        <cfif len(handler)  
    170172                                  AND len(action)  
     
    172174                                <cfset newpath = newpath & "/" & action /> 
    173175                        </cfif> 
    174                          
     176                        <!--- Relocation headers ---> 
    175177                        <cfif httpRequestData.method EQ "GET"> 
    176178                                <cfheader statuscode="301" statustext="Moved permanently" /> 
     
    178180                                <cfheader statuscode="303" statustext="See Other" /> 
    179181                        </cfif> 
    180                          
     182                        <!--- Relocate ---> 
    181183                        <cfheader name="Location" value="#getBaseURL()##newpath##serializeURL(httpRequestData.content,event)#" /> 
    182184                        <cfabort /> 
     
    212214                <cfset var qsVal = "" /> 
    213215                <cfset var requestString = arguments.action /> 
     216                <cfset var conventionString = ""> 
     217                <cfset var conventionStringLen = 0> 
     218                <cfset var tmpVar = ""> 
    214219                <cfset var routeParams = arrayNew(1) /> 
    215220                <cfset var routeParamsLength = 0> 
     
    260265                        <!--- Try to match this route against the URL ---> 
    261266                        <cfset match = REFindNoCase(thisPattern,requestString,1,true) /> 
    262                         
     267                 
    263268                        <!--- If a match was made, use the result to route the request ---> 
    264269                        <cfif (match.len[1] IS NOT 0 AND getProperty('looseMatching')) OR  
    265270                                  (not getProperty('looseMatching') and match.len[1] IS NOT 0 and match.pos[1] EQ 1) > 
    266                                 <cfset foundRoute = thisRoute />                                
     271                                <cfset foundRoute = thisRoute /> 
    267272                                <!--- For each part of the URL in the route ---> 
    268273                                <cfloop list="#thisRoute.pattern#" delimiters="/" index="thisPattern"> 
     
    274279                                        </cfif> 
    275280                                </cfloop> 
    276                                  
    277281                                <!--- And leave the loop 'cause we found our route ---> 
    278282                                <cfbreak /> 
    279                         </cfif> 
    280                          
     283                        </cfif>                  
    281284                </cfloop> 
    282285                 
     
    287290                </cfloop> 
    288291                 
    289                 <!--- Now set the rest of the variables in the route ---> 
     292                <!--- Convention String, where it will translate the remaining name-value pairs into vars ---> 
     293                <cfset conventionString         = right(requestString,len(requestString)-(match.pos[arraylen(match.pos)]+match.len[arrayLen(match.len)]))> 
     294                <cfset conventionStringLen      = listLen(conventionString,'/')> 
     295                <cfset tmpVar                           = ""> 
     296                <cfif conventionStringLen gt 1> 
     297                        <cfloop from="1" to="#conventionStringLen#" index="i"> 
     298                                <cfif i mod 2 eq 0> 
     299                                        <!--- Even ---> 
     300                                        <cfset params[tmpVar] = listGetAt(conventionString,i,'/')> 
     301                                <cfelse> 
     302                                        <!--- Odd ---> 
     303                                        <cfset tmpVar = listGetAt(conventionString,i,'/')> 
     304                                </cfif> 
     305                        </cfloop> 
     306                </cfif> 
     307                 
     308                <!--- Now set the rest of the variables in the route: handler & action ---> 
    290309                <cfloop collection="#foundRoute#" item="key"> 
    291310                        <cfif key IS NOT "pattern"> 
     
    298317         
    299318        <!--- Add a new Course ---> 
    300         <cffunction name="addCourse" access="private" hint="Adds a route to dispatch" output="false"> 
     319        <cffunction name="addCourse" access="public" hint="Adds a route to dispatch" output="false"> 
    301320                <!--- ************************************************************* ---> 
    302321                <cfargument name="pattern" type="string" required="true" hint="The pattern to match against the URL." /> 
  • coldbox/trunk/testharness/config/coldbox.xml.cfm

    r1588 r1590  
    4444                <Setting name="MyStruct" value="{name:'luis majano', email:'info@email.com', active:'true'}"/> 
    4545                <Setting name="MyArray"  value="[1,2,3,4,5,6]"/> 
    46                 <Setting name="MyBaseURL"  value="jfetmac" /> 
     46                <Setting name="MyBaseURL"  value="apps.jfetmac" /> 
    4747        </YourSettings> 
    4848         
  • coldbox/trunk/testharness/config/routes.cfm

    r1589 r1590  
    5959        Else, htmlBaseURL and sesBaseURL should be the same. 
    6060---> 
    61 <cfset setBaseURL("http://#getSetting('MyBaseURL')#/coldbox/index.cfm")> 
     61<cfset setBaseURL("http://#getSetting('MyBaseURL')#/coldbox/testharness/index.cfm")> 
    6262 
    6363 

Copyright 2006 ColdBox Framework by Luis Majano