PRC? Private Request Collection - Computer Know How

PRC? Private Request Collection - Computer Know How PRC? Private Request Collection - Computer Know How

compknowhow.com
from compknowhow.com More from this publisher

The ColdBox


� Bi-Weekly Free Training/Presentation<br />

Webinars<br />

� Lead by ColdBox Team Members<br />

� Empower the ColdFusion Community<br />

with <strong>Know</strong>ledge<br />

� ColdBox Platform Related Topics<br />

� Expected Community Involvement<br />

� <strong>Request</strong> Topics at<br />

http://coldbox.uservoice.com


� October 27 th – ColdBox Best Practices?<br />

� http://coldbox.org/about/eventscalendar


� ColdBox 3.5<br />

� http://wiki.coldbox.org/wiki/WhatsNew:3.5.0.cfm<br />

� BlogBox<br />

� Send us an email to join the private beta


The ColdBox Connection


� Husband<br />

� Dad<br />

� Coach<br />

� Youth leader<br />

� Co-owner of<br />

<strong>Computer</strong><br />

<strong>Know</strong> <strong>How</strong><br />

� Member of<br />

TEAM ColdBox


� RC: <strong>Request</strong> Context – NO!<br />

� The <strong>Request</strong> Context is an object passed<br />

to handler methods called Event<br />

� RC: <strong>Request</strong> <strong>Collection</strong> – Yes!<br />

� Data structure used to move data from<br />

the layers of your application


� FORM/URL/REMOTE variables meshed<br />

into a single structure<br />

� Form variables FTW!<br />

� <strong>PRC</strong>? <strong>Private</strong> <strong>Request</strong> <strong>Collection</strong> (no<br />

outside vars, only what you put in)<br />

� Every part of the framework life cycle<br />

either receives a reference to it or has<br />

access to it<br />

� Passed as an argument to event handlers as<br />

of ColdBox 3.5<br />

� WOOT!!!


� The request context object is<br />

passed to your event handlers<br />

as an argument called: event<br />

� The type is<br />

� coldbox.system.web.context.<strong>Request</strong>Context<br />

� Managed by the <strong>Request</strong> Service<br />

� controller.get<strong>Request</strong>Service()<br />

<strong>Request</strong><br />

Context<br />

RC<br />

<strong>PRC</strong>


� Method to get the request collection<br />

� event.get<strong>Collection</strong>(private)<br />

� Access from plugins, etc<br />

� controller.get<strong>Request</strong>Service.getContext()<br />

� Already available on layouts and views<br />

via event variable


� The request context has some great<br />

metadata methods available<br />

� getCurrentAction(), getCurrentHandler(),<br />

getCurrentEvent()<br />

� getCurrentLayout(), getCurrentView()<br />

� getDefaultLayout(), getDefaultView()<br />

� isProxy<strong>Request</strong>(), isSES()<br />

� getEventName()<br />

� getCurrentModule(), getModuleRoot()


� Some common methods<br />

� buildLink(linkto)<br />

� get<strong>Collection</strong>()<br />

� getValue(key,[default])<br />

� setValue(key,value)<br />

� valueExists(key),paramValue(key,value)<br />

� setView(name,…)<br />

� setLayout(layout)<br />

� renderData(type,data,contentType)<br />

� Many many more…


� The request context can be extended by<br />

using the decorator pattern<br />

� You can use a decorated request context<br />

to meet your needs. Extend or add<br />

functionality to your hearts content


� More information about ColdBox RC<br />

� http://www.coldbox.org<br />

� http://wiki.coldbox.org/wiki/<strong>Request</strong>Context.cfm<br />

� Get ColdBox @ http://www.coldbox.org/download<br />

� Contact information<br />

� E-mail: gratzc@compknowhow.com<br />

� Blog: http://www.coldbox.org/blog<br />

� Twitter: gratzc<br />

� MSN/Gtalk IM: gratzc@compknowhow.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!