I've been trying to get ColdFusion's REST URL support working. In the past whenever I've needed to integrate REST with ColdFusion I would have the Single Page Application directly call the CFC, using a URL like this:
It worked great. And technically it was REST, however REST has evolved in this industry. When I'm working with clients we are more likely to use more structured REST APIs and specific API verbs beyond just GET and POST. Maybe something like this:
ColdFusion introduced functionality to do this in CF10 and there are a bunch of articles about how this works. Here are a few good ones.
I had the darnest problem getting this to work. My local dev environment is an Apache Web Server and ColdFusion 10--I know we should upgrade. After some banging of my head, it really appeared that the "rest" directory was being processed as if it were a traditional web server directory and not passed onto ColdFusion. I dug through a lot of CF Config files. I even found some stuff about creating or renaming your own directory in Coldfusion. This is a good article on that.
I reviewed the Apache config, mod_jk.conf. I saw that there was a handler for specific file extensions, such as cfm and cfc:
But, I did not see any way that Apache would tell ColdFusion that all directories with 'rest' would be passed onto ColdFusion.
It took a bit more dumping, but I had to add this into my Apache Config:
2 SetHandler jakarta-servlet
3</Location>
After a server restart everything started magically re-working. I bet a lot of the other directories listed in the CF Config for `uriworkermap.properties` would have had similar problems if I still used the Flex or CFForms. I'm surprised this setup was not default in the CF Generated `mod_kj.conf`.
I hope this helps someone at some point.