RE: [coldbox:16444] [coldbox-3.5.2] clarfication on buildLink() behaviour pls

Are you using SES URLs?

i.e. Do your URLs look like this:
www.domain.com/index.cfm?event=foo.bar
or like this
www.domain.com/index.cfm/foo/bar

I use SES URLs and I have an interceptor that on preProcess sets the SES Base URL for that request (because my site can be hit with more than one domain). event.buildLink() always creates full URLs for me. Of course, that being said, I’ve actually decorated my request context object and overridden the buildLink() method to consult an SSL Service of mine before it builds the URL, so all bets might be off. Yeah, I just checked and my request context decorator’s buildLink() is set up to always return a full URL using the following to calculate the correct base URL:

var sesBaseURL = “http://” & cgi.http_host & iif(len(trim(variables.AppMapping)),de("/"),de("")) & variables.AppMapping & “/index.cfm”;

Your solution of passing in the base URL to buildLink will work fine, but if you don’t want to do it every time (I certainly didn’t) then you can decorate your event object and customize how buildLink() works. I’m not entirely sure why that’s not a built-in option. I guess I’ve been using my custom solution for so long I forgot what the default behavior is.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad
I’m back on the case with this today after a bit of a hiatus (work… family… generally being sick of working outside normal work hours ;-). Cheers for the response below: it all makes sense.

I guess I shall look up how this “decorator” notion works, although for the time being, I think my solution is adequate. I was more just wanting to confirm I wasn’t missing anything, which it seems I am not.

Thanks mate.