I have to admit I am not very au fait with the idiosyncrasies of REST requests. To me a REST request is just... a request. The difference being the mechanism at the other end is more likely to respect verbs other than GET and POST like normal browser-based requests make, and they return "data" rather than mark-up. But other than that: there's nothing really to them. It's more a concept / strategy than anything else.
In this light, a while back I noticed that a REST request I was making didn't fire the associated
onCfcRequest()event handler, as documented here: "REST requests don't seem to correctly use Application.cfc either". I duly raised a ticket: 3590745.
Rupesh has come back with this:
OnCFCRequest is meant for the requests which are made directly to the CFC - as AJAX request or directly over HTTP. For Rest request or web service or web socket requests, CFC happens to be an end point to a request (where the CFC is not explicitly invoked) and therefore OnCFCRequest is not called for these three types of requests.
I understand what he's saying, but to me - as I say in my follow-up - what he says seems like an example of post hoc ergo propter hoc. Basically the conclusion drawn is not implied by the supporting information. Here's what I said in response:
That seems like an example of "post hoc ergo propter hoc" to me. All those types of request, as an entry point to the application, call a CFC. ALL ColdFusion requests are serviced by either a CFM or a CFC, so any given request ought to run one of onRequest() or onCfcRequest(). You are not making clear the distinction that makes web sockets, SOAP web service or REST web service requests any different.
If there *is* a distinction, the you probably need a third event (/handler) for Application.cfc:
onSomeOtherSpecialRequestWhichApparentlyIsForNeitherACfmOrCfc()(the name might need [some work]).
Can you pls clarify without the logical fallacy that "because of x then y", when one does not intrinsically follow from the other.
But, as I say, I'm no expert in these things, so I don't know what the expectations might be, and accordingly whether what Rupesh says seems reasonable, or - whether or not it's by design - it is design based on faulty reasoning.
Can anyone clarify?
Update:I've also asked about this on the Railo Google Group, as they're usually pretty quick to answer this sort of stuff: "REST request event handler expectations".