tracker issue : CF-3590745

select a category, or use search below
(searches all categories and all time range)

REST method calls do not correctly fire Application.cfc event handlers

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 07/06/2013

Components: REST Services

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Platforms All

Vote Count: 0


REST method calls don't fire onCfcRequest(). It's logged separately that they also don't fire onError().

To be completely, plainly clear: if they fire *any* of them, they should fire *all* of them (as appropriate).


----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3590745

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:



This is not the same as the ticket it's marked as a duplicate of. Pls reopen. -- Adam
Comment by External U.
15028 | December 04, 2013 05:19:52 AM GMT
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.
Comment by Rupesh K.
15029 | January 03, 2014 06:57:21 AM GMT
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 word). Can you pls clarify without the logical fallacy that "because of x then y", when one does not intrinsically follow from the other. Cheers. -- Adam
Comment by External U.
15030 | January 03, 2014 07:16:25 AM GMT
well, the argument can be made either way. The way it is designed right now is - if the call is explicitly to the CFC, onCFCRequest is called. I think another reason for this design might be the way these frameworks are wired with Axis, Jersey etc. It would have been really difficult to hook in these event handlers - but that is my guess.
Comment by Rupesh K.
15031 | January 03, 2014 08:54:55 AM GMT
Cheers Rupesh. I posted on my blog details of this conversation to see if anyone could explain it in a way I understand, and Adam Tuttle perhaps explained what you were driving at? If that's the case, I dunno I agree that how it's been done makes *perfect* sense, but I kinda see what you mean. Is Adam on the right track? I also looked at what Railo does, and it's the same (in this context). I asked them about it too:!msg/railo/GTQZiQNe8vg/IDCOcT_ClUoJ Just FYI. Cheers. -- Adam
Comment by External U.
15032 | January 03, 2014 09:04:31 AM GMT
Rupesh, hello?
Comment by External U.
15033 | August 03, 2014 04:25:27 PM GMT
oh sorry Adam. I didn't notice that you were waiting for my response on this. yes, Adam Tuttle has explained it well in your blog comment. The idea of supporting onRequest()/onRestRequest() is something we can evaluate. Could you please log a separate enhancement for that?
Comment by Rupesh K.
15034 | August 04, 2014 12:35:28 AM GMT
Done: Cheers.
Comment by External U.
15035 | August 04, 2014 03:16:53 AM GMT
Thanks Adam! FWIIW, we do invoke onRequestStart() for REST request.
Comment by Rupesh K.
15036 | August 04, 2014 04:35:00 AM GMT
Yup, that's where all this started from. Remember my blog article ( was questioning why SOME Application.cfc event handlers get called with REST requests, but not ALL (as appropriate) do. The sticking point is, as you've assessed, there's no request *interceptor* (like onRequest() or onCfcRequest()) available for REST requests. I think this is the only remaining missing piece of the puzzle. -- Adam
Comment by External U.
15037 | August 04, 2014 05:43:16 AM GMT
Seems that CF-3799243 is a reasonable solution to this. Adam?
Comment by External U.
15038 | October 27, 2015 08:57:27 PM GMT
Yup. It's this discussion that that ticket arose from.
Comment by External U.
15039 | October 28, 2015 02:41:20 AM GMT