Playing with ColdBox request context decorators
I am working on a project that will eventually require a login. That being said, it would be nice to always have information for the currently logged in person stored in the PRC. ColdBox has a built in class fittingly called RequestContextDecorator which will easily handle this.
Here is a basic request context decorator:
There is not a lot going on here but I will cover the basics. First, a request context decorator must extend coldbox.system.web.context.RequestContextDecorator. Next a configure() method is required that will modify how the request contexts behave once they are created. Getting the original request context is handled by calling the getRequestContext() function and additionally you can get the private RC by calling getRequestContext(private = true).
Now you can modify the RC and PRC with any values you like. For extra points I have included getting ColdBox settings as well as getting an instance of a service through Wirebox.