routes

Still trying to get my head around this, but can someone answer me why these 2 differ? In other words, the route is convereted incorrectly when using –numeric

<cfset addCourse( pattern=" /:year/:month/:day?/:blogTitle?", handler=“blog”, action=“entryDisplay” )>

<cfset addCourse( pattern=" /:year-numeric/:month-numeric/:day-numeric?/:blogTitle?", handler=“blog”, action=“entryDisplay” )>

For example

/2008/01/01/test

Becomes

Rc.year = 2008

rc.month = 2008

rc.day = 07

rc.title = 07

Anyone know why? Where as the correct values are inserted into the year, month etc.

Can you post your routes.cfm Andrew.

I will try to recreate it here.

Please describe the problem again, sorry, but I need it in detail so I can run tests.

Luis

Luis,

Take the standard routes file, add the course at the bottom with either –numeric added or not. Then in the event handler dump(rc); abort(rc);

The problem I have is that when I dump without the –numeric in the routes, the url is converted correctly. When placing the course with the –numeric the data is incorrect. For example the month = 2008 and the year = 2008 and the day equals what the month should be.

I have this problem running on 2 sites, one with the application I am working on. And the other is in a stock standard vanilla coldbox installation. Both give the same result.

The url used is

/index.cfm/2008/01/24/some-title

See my previous post listed below with the exact dump of the rc when –numeric is used with the above URL.

Andrew, the problem is the following:

Take the standard routes file, add the course at the bottom with either –numeric added or not. Then in the event handler dump(rc); abort(rc);

In the guide it explicitly says that order is important. Order is important because routes can have similar signatures. What happens is that the default coldbox routes run before the custom ones you created and of course, they match.

You need to place your routes according to the order you want them to be evaluated.

Luis

Ok, and the order is what?

I thought about that, by even taking this.

<cfset addCourse(pattern="/:year/:month/:day?/:blogTitle?", handler=“blog”, action=“entryDisplay” )>

<cfset addCourse(":handler/:action?/:id?")>

And making it

<cfset addCourse(":handler/:action?/:id?")>

<cfset addCourse(pattern="/:year-numeric/:month-numeric/:day-numeric?/:blogTitle?", handler=“blog”, action=“entryDisplay” )>

But no go, it still evaluates to what I reported. So if I am doing something wrong could you elaborate some more please. From what I can tell, the correct handler is being called, because they are 2 separate handlers and only one has the /:year handler with a dump and abort in it.

This tells me that it is being matched fine, it is when it gets the data out of the url that seems to be the problem. So if I make the :year as :year-numeric the correct values disappear and I get garbage as discussed earlier.

It has me confused, because I could not find anything about the order in which they run. For example is top down, as in the above examples or bottom up? You’re explanation tells me bottom up, if the default ones are run first. Just couldn’t decipher that information out of the documentation. For your reference here is the bottom of the routes file as it stands right now. Which works, and if I am understanding you right. I should take the course for year, month and day to below the standard courses. Which goes against the comments in the file.

So the order in this case? Is it bottom up? This is as I think the one area I fully can’t seem to grasp.

<cfset addCourse( pattern="/account/:action/:username/:password", handler=“account”, action=“doLogin”) />

<cfset addCourse( pattern="/admin/", handler=“admin”, action=“view”) />

<cfset addCourse(pattern="/:year/:month/:day?/:blogTitle?", handler=“blog”, action=“entryDisplay” )>

<cfset addCourse(":handler/:action?/:id?")>

Is there any ETA on this problem?

Like I stated if the route for /index.cfm/2008/05/20/something-for-you-to-try

/:year-numeric/:month-numeric?/:day-numeric?/:blogTitle?

Or

/:year /:month?/:day?/:blogTitle?

Both run the correct event, but the problem is that if using the –numeric the conversion of the URL is totally screwed.

Causing the following if none numeric in the course!!

Year: 2008

Month: 05

Day: 20

blogTitle: something-for-you-to-try

Now switch to –numeric in the course!!

Year: 2008

Month: 2008

Day: 05

blogTitle: 05

You can see that there is a huge problem when converting an SeS numeric to the Request Collection. This is serioulsy limiting me from continuing, so I really need an answer on this as quickly as possible.

And no I haven’t been able to investigate that section of code myself.

Another question, I turned line debugging on in both fusionDebug and Coldfusion 8 debugging and neither of these two programs will line debug Coldbox framework. This as I see at the moment is not related to Coldbox as such. As it appears to do it in anything that is run from the Application.cfc

So my question is this, when line debugging the framework? How do you go about this? Is it a caching issue, or something more sinister like outputsetting or processingdirective or something that may interfere with the debugger? So far I have no response from either Adobe or the team at Fusin Debug as of yet.

Please I do not want to hear about the order of the routes, before complaining or mentioning this I played with the order of the routes for 2 weeks even to the point of removing all courses but the one above. And as I clearly stated the first time, the request collection always contains the wrong data when using the –numeric option, and the correct event is always called. I feel bad that it has take a few emails to bring this problem to your attention, but I do serioulsy need an fix or a work around for now. Even to the point of shutting down the machine, and rebotting to totally clear the machines ram and caching.

If anyone is interested, my old blog is now running a new Application that is built ontop of Coldbox. And is this is now live, I really need to find a solution as quickly as possible to start switching on the rest of my website features.

If anyone is interested, the url is http://www.andyscott.id.au/ I still need to tweak the config settings and such to optimise the site for low traffic. But I’ll get there.

I still have not found time to look into this Andrew, but I have it as a task to debug why the numerical routes are giving any problems
As soon as I have an answer I will post my results.

Andrew

I believe I am able to reproduce your error and I believe it is a bug
with the pattern matching groups upon regular expressions for
numerical routes. I have logged a bug for this and will have to set
aside time to figure out how to fix it. For a workaround, just use
the normal alphanumerical routes for now until a fix can be provided.

Luis

Luis,

Cheers much appreciated, sorry I haven’t had a chance to debug it either. And every time I sit down to begin, I am side tracked with client issues L

Thanks,

I was able to confirm the same thing, only problem as discussed I haven't
had the time to look into the reason as to why it is doing what it is doing.

But thanks for confirming it, I felt at times I might have been the only one
experiencing it:-)

As for the current work around suggested, that's what I am doing for now.
But due to the ordering etc of routes, it is not ideal to go live with. But
that's ok, it is urgent but not critical if that makes sense.

Andrew,

Can you please try this fix. Open the following:
coldbox.system.interceptors.ses

And change line 276 to the following:
<cfset thisPattern = REReplace(thisPattern, “:.*?-numeric/”, “([0-9]+?)/”, “all”) />

Reinit your application and please try all the numerical routes again. I believe I was doing sub-grouping before and patterns where basically repeating.

Please confirm your results with me and let me know so I can add this fix to 2.6.2

Luis,

Thank you so much that worked a treat…