tag:blogger.com,1999:blog-5424132702988443424.post874932151755181720..comments2023-10-26T07:43:05.437-05:00Comments on Bears. Beets. Battlestar Galactica.: Handling HTTP Request Parameters in ColdFusionTony Nelsonhttp://www.blogger.com/profile/17222036859676784775noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-5424132702988443424.post-28981625362519903692010-03-04T12:09:30.727-06:002010-03-04T12:09:30.727-06:00In the example I'm using an Application.cfc wr...In the example I'm using an Application.cfc written in script. The tag-based equivalent would be:<br /><br /><cfcomponent><br /><br /> <cffunction name="onRequestStart"><br /><br /> <cfset var params = {} /><br /> <cfset structAppend(params, url) /><br /> <cfset structAppend(params, form) /><br /> <cfset getPageContext().getFusionContext().hiddenScope.params = params /><br /><br /> </cffunction><br /><br /><br /></cfcomponent>Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-41943864702736432282010-03-04T12:06:33.274-06:002010-03-04T12:06:33.274-06:00Is this code put inside a cfscript tag within the ...Is this code put inside a cfscript tag within the onRequestStart component? I am one of these people that need every little detail spelled out before I can wrap my brain around it.mxuserhttps://www.blogger.com/profile/11955450568697236071noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-35647425229480218522009-12-15T08:38:12.160-06:002009-12-15T08:38:12.160-06:00@blitz,
I've worked with ColdBox before and I...@blitz,<br /><br />I've worked with ColdBox before and I'm familiar with the request collection. I would just prefer something a little more straight-forward than "rc", like "params". People new to the ColdBox framework probably have no clue what "rc" is, where they could take a pretty good guess if it were named "params".Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-3318022430912458132009-12-15T06:17:11.215-06:002009-12-15T06:17:11.215-06:00For those of us who have worked with ColdBox, the ...For those of us who have worked with ColdBox, the rc scope isn't "cryptically named". It stands for "request collection." In earlier versions, you had to use event.getValue(key) in both controllers and views (and you still can do it that way). But it became a convention to do rc = event.getCollection() which returns a structure with all your request collection variables so you didn't have to use getters. Eventually, that "rc scope" was automatically made available to views.Tony Garciahttps://www.blogger.com/profile/04305038968593908632noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-40505734550412856022009-12-14T20:29:51.055-06:002009-12-14T20:29:51.055-06:00@Henry,
According to Ben's post it's undo...@Henry,<br /><br />According to Ben's post it's undocumented.Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-87552440224070986332009-12-14T14:53:21.373-06:002009-12-14T14:53:21.373-06:00I don't feel comfortable using getPageContext(...I don't feel comfortable using getPageContext().getFusionContext().hiddenScope.params ...<br /><br />Is this documented? or undocumented?Anonymoushttps://www.blogger.com/profile/17002578166283757395noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-16074383031187726962009-12-14T12:27:32.850-06:002009-12-14T12:27:32.850-06:00Hmm, very interesting. I had never thought of usin...Hmm, very interesting. I had never thought of using it in that respect.Unknownhttps://www.blogger.com/profile/14054723593701580342noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-74275831265847510992009-12-14T11:29:26.552-06:002009-12-14T11:29:26.552-06:00@Todd,
Good point about duplicate keys. Most fram...@Todd,<br /><br />Good point about duplicate keys. Most frameworks do mention that the form scope takes precedence over the url scope. I just didn't bother to point it out.<br /><br />Another thing to mention would be that the form scope doesn't exist in WSDL-base remote requests, so you'd probably want to throw an isDefined('form') in there too.Tony Nelsonhttps://www.blogger.com/profile/17222036859676784775noreply@blogger.comtag:blogger.com,1999:blog-5424132702988443424.post-65837384158191890002009-12-14T10:58:38.414-06:002009-12-14T10:58:38.414-06:00Yeah, I don't really care for using the hidden...Yeah, I don't really care for using the hiddenScope thing, but that's another discussion.<br /><br />The main thing you should point out in your example is that if duplicate keys exist then the form scope entry (again, in your example) will overwrite the url scope variable. That can be a bit tricky to folks who use this method.Todd Sharphttps://www.blogger.com/profile/06713192966432687753noreply@blogger.com