Hello all, I am having some troubles getting my SES URLs working properly. I am using ColdBox 4.3, and the issue is the same on Apache on my dev machine or IIS 8 on production, so evidently it is (as usual) something I am doing wrong.
Here is an example of a URL in its native format:
index.cfm?event=organizations.getOrganization&organizationID=#prc.organizations.organizationID#
When I configure basic SES URLs in my ColdBox app, and I use this:
#event.buildLink(linkTo=‘organizations.getOrganization’, queryString=‘organizationID=#prc.organizations.organizationID#’)#
I do get a nice pretty SES URL (example: http://127.0.0.1:62469/organizations/getOrganization/organizationID/376). Very nice!
But I also get a big fat “Variable ORGANIZATIONID is undefined” error from my handler, which is expecting a URL variable (organizationID). Hardcoding the organization ID, removing the octothorpes, etc, makes no difference. My handler just does not get the organization ID from trying to build the link this way.
This works: #event.buildLink(‘organizations.getOrganization’)#?organizationID=#prc.organizations.organizationID#
(It produces http://127.0.0.1:62469/organizations/getOrganization?organizationID=376)
And this works: #event.buildLink(‘organizations.getOrganization?organizationID=#prc.organizations.organizationID#’)#
(It produces the same URL).
The trouble is the query string in the URL, which I do not want. Since Example A does produce a nice friendly URL, my guess is that I am either not configuring the URL properly to pass along the variable to the handle, or I am doing something in the handler itself which causes it to not recognize the incoming variable. But I cannot figure out which!
Here is the specific line from handler referenced in the error message:
prc.getOrganization = organizationModel.getOrganization(organizationID);
I sure would appreciate any help! I am stuck. Many thanks!