[coldbox:18340] [coldbox-3.6.0] - setLooseMatching question

David,

What are you planning on for a route? Your understanding is correct (I believe) but you need to make sure you are specific enough that your route gets picked up only when you want it too. Also, order will still matter so make sure you consider that.

Curt

Thanks Curt, The route in the example is “/site/startPage”. I’m getting CB installed so I can experiment with this.

OK, I’ve gotten a test system up and ran into a snag. Here is the test URL:

http://www.mysite.com/Sports/Eastern-Spring-Tournament/LastName/Smith/participantID/123456/EventID/12342013S3/site/home

I have a handler called ‘site’ that has a home function/action in it. http://www.mysite.com/site/home works, but the above URL does not. The error message is:

Error Type: HandlerService.EventHandlerNotRegisteredException : [N/A]
Error Messages: The event: Sports.Eastern-Spring-Tournament is not valid registered event.

There is no handler named ‘Sports’. The first part of the URL (“Sports/Eastern-Spring-Tournament/”) is just SEO fluff that I have to add for the marketing team … and they want it first. The other part of the URL are variables to find the event and participant info “LastName/Smith/participantID/123456/EventID/12342013S3/”.

In my Routes.cfm file I have:

setEnabled(true); setUniqueURLS(false); setLooseMatching(true); setAutoReload(true);

if( len(getSetting(‘AppMapping’) ) lte 1){
setBaseURL(“http://#cgi.HTTP_HOST#/index.cfm”);
}
else{
setBaseURL(“http://#cgi.HTTP_HOST#/#getSetting(‘AppMapping’)#/index.cfm”);
}

addRoute(pattern=":handler/:action?");

I had thought (hoped) that setting setLooseMatching(true); would find the handler/action of site/home at the end. The marketing SEO values, in this case “Sports/Eastern-Spring-Tournament/”, could be anything they want to assign to an event, so maybe I need to add some ‘addRoute()’ statements with some place holders? If so, what would valid place holders be when I don’t have a list of the real values?

Thank you for your help!

That is impossible because loose matching is based on concrete patterns not variable placeholders

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano

Thanks for helping with this. I think I’m making progress. In the example,

http://www.mysite.com/Sports/Eastern-Spring-Tournament/LastName/Smith/participantID/123456/EventID/12342013S3/site/home

‘Sports’ is an event category and ‘Eastern-Spring-Tournament’ is the name of the event. The other name/value pairs are regular URL variables. I created a test route rule like this:

addRoute(pattern="/Sports/:eventName/LastName/:LastName/participantID/:participantID/EventID/:EventID", handler=“site”, action=“login”);

That seemed to work. They have 10 different event categories, so I guess I could add a route for each one just like the above but instead of ‘Sports’ have ‘School’, ‘Corporate’, etc. With the above route, both

http://www.mysite.com/Sports/Eastern-Spring-Tournament/LastName/Smith/participantID/123456/EventID/12342013S3/site/home

and

http://www.mysite.com/Sports/Eastern-Spring-Tournament/LastName/Smith/participantID/123456/EventID/12342013S3

work the same. In fact, if I set setLooseMatching(false), they still work they same. I wonder what an example of using the setLooseMatching would be?

David