Just as a follow up on this--is anyone using oncfcrequest() ?
On Monday, December 1, 2014 9:36:42 AM UTC-7, John Moss wrote: > > I'm using OpenBD 3.1 > > By following Raymond Camden's blog at: > http://www.raymondcamden.com/2009/7/13/ColdFusion-9-fixes-onRequest-adds-onCFCRequest > I created an OnCFCRequest() handler in my Application.cfc like so: > > > public any function onCFCRequest(string cfcname, string cfcmethod, struct > args) > { > // These CFCs are restricted to HTTPS POST access: > > var post_only = [ "card_info", "card_swipe", "card_type", "card_valid" > ]; > var ret = ""; > > if (lcase(cgi.request_method) != "post" and arrayfindnocase(post_only, > cfcmethod) > 0) > { > ret = "Methods involving card numbers are restricted to HTTPS > POST only."; > } > else > { > var comp = createobject("component", cfcname); > var ret = evaluate("comp.#cfcmethod#(argumentcollection=args)"); > } > > return ret; > } > > > This works but to me the createobject-->evaluate portion seems quite messy. > (The blog states this also.) > > The real issue though is that this code breaks the "returnformat=json" > portion of my cfc so that it seems to be completely ignored. > The only way to get json returned with this event handler in place is to > provide "__bdreturnformat=json" in the cfc invocation. > > When I comment-out this event handler the cfc returns json (because it > specifies returnformat="json" in the function declaration.) > When I un-comment it the cfc returns only WDDX unless I add > &__bdreturnformat=json to the call. > > So my questions are: > > 1. Is there a better way to do the oncfcrequest() which is not so messy? > 2. Is there a way to get it to recognize the returnformat in the cfc > without having to specify it in the call to the cfc? > > Thanks! > John Moss > > > -- -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en --- You received this message because you are subscribed to the Google Groups "Open BlueDragon" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
