G’day
I’ve googled about and have found a coupla links on this, so I think I know the answer, but the answer makes me go “really??” so I thought I’d ask.
The buildLink() method… there is nothing that I am missing about it other than is stated in the docs… it cannot be made to return a fully-qualified URL unless I basically do all the work myself to tell it what the fully-qualified bit of the URL is?
What I was expecting to see is something like this:
myUrl = event.buildLink(linkTo=“controller.method”,fullyQualified=true)
And this would return “**http://mydomain/path/tp/app/**index.cfm?event=controller.method” instead of just “index.cfm?event=controller.method”.
It seems to me the only recourse is to use the baseURL to give it a string “http://mydomain/path/tp/app/”, which is something I need to concoct myself?
It seems a bit of an obvious omission to that method to not just do this for me? Maybe I’m missing something (this is entirely likely).
I read some stuff about this setSESBaseURL() , but this still seems to involve me working out what that URL would be by hand again too.
As a work around I’ve put this in my /config/ColdBox.cfc:
variables.coldbox = {
//[…]
appHomeUrl = “http://#CGI.http_host##CGI.script_name#”, // I can’t be arsed dealing with HTTP[S] and the port for the time being, as it probably won’t matter
//[…]
};
And use that thus:
myUrl = event.buildLink(linkTo=‘account.save’,baseUrl=variables.getSetting(“appHomeUrl”));
Is that as good a way as any? Is this base URL hidden away somewhere already that I just haven’t found?
Oh… context… why do I need a fully-qualified URL? Because I need to stick a URL to a page in an email I’m sending, so a relative one ain’t much chop.
I had previously read these threads, which got me to where I am now:
https://groups.google.com/d/topic/coldbox/kkX9ep_hSqw/discussion
https://groups.google.com/d/topic/coldbox/B6SFJArn8Fo/discussion
Cheers for any guidance.