coldfusioncoldfusion-9coldfusion-10fw1

FW/1 - Accessing RC in setupRequest()


I'm using FW/1 ver 3.5.0 with CFM request context (rc) in setupRequest() but have been successful. According to the documents (http://framework-one.github.io/documentation/3.5/developing-applications.html#basic-application-structure) I need to add a before() in the application.cfc and the controller. I must be over looking something, any suggestions would be much appreciated.

Thank you!

application.cfc

function before( struct rc ) {
}

controller

function before( struct rc ) {
}

Solution

  • One of the things that I wish was better explained was the difference between setupRequest() and before()

    setupRequest() happens before rc even exists.

    before() happens after setupRequest() is ran and does have access to rc.

    An easy way to remember what goes where is. If rc is involved, put it into before(). If not, put it in setupRequest()

    Note

    This is a change from earlier versions for FW/1. Previously this distinction did not exist. This can be an issue when migrating.

    Also

    You don't need to add a before() in application.cfc nor in your controller. You only add them if needed. One of the strengths of FW/1 is that most things are optional. If you need something, there will be a place for them.