[ColdBox-3.5.0] About SESroute

I need an url like : mysite.com/parametername-parametervalue

Instead of “/” to separate parametername and value I need a “-”.

It’s possible to set this with sesroutes?

No, right now ses urls use the standard / delimiter. If you want to use your own delimiter, I would suggest adding a rewrite rule to your web server, like apache, that translates the - to /

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

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Actually, you can do this with ColdBox.

If you add the following method to your routes.cfm file, things should work like you expect.

function PathInfoProvider(Event)
{
return replaceNoCase(CGI.PATH_INFO,’-’,’/’,‘all’);
}

The PathInfoProvider allows you to manipulate the CGI.PATH_INFO value before the SES Interceptor does it’s thing allowing to you do all sorts of custom routing.

You can read about it in the release notes for 3.0: http://wiki.coldbox.org/wiki/WhatsNew:3.0.0.cfm

-Aaron

Hmmm… I did not realize that CB had this PATH_INFO_PROVIDER ability.

So what are the thoughts on using CB SES vs. mod_rewrite (Apache)/URL Rewrite (IIS)/etc.? Or a combination of the two? Assuming you want to remove the “.cfm” you need to use the URL rewriting anyways, so at that point is it better to abandon CB’s SES capabilities? My assumption is that either Apache’s or IIS’s URL rewriting engine would be more performant than having CB (CFML) handling it?

What are most people doing… and why?

Thanks,
Andy

I didn’t know this feature.

Probably this could solve my problem.

Many thanks

How can I make an url became univoque?

I explain: if I have a route: “addRoute(pattern=“page/:id”,handler=“general”,action=“struttura”);” this work if I wrote in my browser SITEdotCOM/page/12/ and also if I wrote SITEdotCOM/page/12/everythingelse

So I have two or more valid url point to the same page. This is not good.

How can I prevent this happens? I should create an interceptors that check if the url is correct (the first one) and redirect the wrong urls?

Define more routes if they are actually unique events.

Routes are evaluated in order they are listed, so, place the most specific at the top and the most broad/general at the bottom.

addRoute(pattern=“page/:id/everythingelse”,handler=“general”,action=“struttura”);addRoute(pattern=“page/:id/something_else”,handler=“general”,action=“struttura”);
addRoute(pattern=“page/:id/more/:can_go/:here?”,handler=“general”,action=“struttura”);
addRoute(pattern=“page/:id”,handler=“general”,action=“struttura”);

Probably I explained bad my problem, mostly due to my poor english language skills.

I need a method, interceptors or something else that prevent an url became too long and different from my needs.

I need for example that only MYSITEdotCOM/page/24/ return my record number 24. But if I write an url like MYSITEdotCOM/page/24/casualtext it NOT returns my record number 24, but give me error 404.

Is this possible? I think I could insert an interceptor that check if my cgi.scriptname is what i was expecting for, if true give me the page, altough give me error 404.

Is this the correct method to do this, or coldbox provide some better solution?

In other words only one url for one resource.

If i wanna have my record number 24 I should write MYSITEdotCOM/page/24/ and if I write MYSITEdotCOM/page/24/casualtext should NOT have my record 24, but should have an error 404.

Is this possible?