What's new with ColdBox 3.0.0

Introduction

ColdBox 3.0.0 is an entirely new release and you must take care when updating from older releases as there might be come compatibility issues that can be found here: Compatibility Guide for pre 3.0.0.

Bug Fixes

Please see here in our Milestone Report all of our Bug Fixes and enhancements

Application Template

  • The new application template has been refactored into more meaningful packages.
  • New application template for power Flex/Air applications with remote monitoring.
  • All generators updated also.

MockBox: The ColdBox Mocking/Stubbing Framework

In one of our most ambitious releases, we are also introducing one of the newest standalone services/frameworks that are now bundled with ColdBox. MockBox is a next generation mocking/stubbing framework that is a necessity when unit testing ColdFusion components. Read our MockBox Documentation

Cache Enhancements

  • New method lookupMulti() so you can do multiple key lookups

ColdBox Factory Enhancements

You can now use the following new functions in the ColdBox Factory

  • getRequestContext() : Get the context object
  • getRequestCollection() : Get a reference to the request collection.

Plugin Enhancements

You now have a few extra methods when dealing with plugin development:

  • getRequestContext() : Get the context object
  • getRequestCollection() : Get a reference to the collection
  • get/setPluginAuthor() : Get the plugin author
  • get/setPluginAuthorURL() : Get the plugin author's url

Feed Generator

  • Additional support formats like iTunes/Atom and so much More
  • Fully documented with new sample applications

Feed Reader

  • Added multiple new XML supports
  • Added more types of generated content from reading feeds
  • Fully documented with new sample applications

Cluster Scope Plugin

New plugin for using the cluster scope on railo enabled CFML engines.

Interceptor Enhancements

  • The methods setNextEvent() and setNextRoute() now execute a postProcess interception point. It can also be deactivated if need be.
  • New interception point: preLayout that ocurrs before any rendering is done or determined. Remember that the preRender point has the entire rendered content passed into it already. So this happens before rendering.
  • New interception point: afterModelCreation that can be used to post-process objects after creation and dependency injections.

New Interceptor: ReactorLoader

The reactor extras have been expanded and a new interceptor has been born called: ReactorLoader. This nice interceptor will configure your application to use Reactor and cache it in the ColdBox cache. Easily configure your app for Reactor ORM

Interceptor Properties

property type required default description
dsnAlias string true N/A The datasource alias name to use, as defined in your datasources section of your config. Make sure you define the dbtype also
pathToConfigXML string true N/A The path of the Reactor config file
project string true N/A The name of the Reactor project
mapping string true N/A The relative path or mapping to the directory where reactor will write generated files
mode string true N/A The reactor mode: always,development,production
ReactorCacheKey string false Reactor The key used to store Reactor as a singleton in the coldbox cache. (case sensitive)
ReactorConfigClassPath string false reactor.config.config The class path override of the reactor configuration object
ReactorFactoryClassPath string false reactor.reactorFactory The class path override of the reactor factory object

So just remember to add the datasource element with a valid dbType as Reactor needs it; Options are:

  • mssql - Microsoft SQL Server 2000 and 2005.
  • mysql - MySQL 5
  • mysql4 - MySQL 4
  • postgresql - PostgreSQL 8
  • db2 - IBM DB2
  • oracle - Oracle 9i and 10g
  • oraclerdb - Oracle RDB (this is not officially supported)

Sample:

<Datasources>
        <Datasource alias="blogDSN" name="simpleblog"   dbtype="mssql" />
</Datasources>

<Interceptors>
<!-- Transfer Loader -->
<Interceptor class="coldbox.system.orm.reactor.ReactorLoader">
  <Property name="dsnAlias">blogDSN</Property>
  <Property name="pathToConfigXML">config/reactor.xml.cfm</Property>
  <Property name="project">MyBlog</Property>
  <Property name="mapping">${AppMapping}/model/reactor</Property>
  <Property name="mode">development</Property>
</Interceptor>
</Interceptors>

This declaration will create the following objects in the ColdBox cache:

Cache Key Object
Reactor The reactor factory object


Important : Please note that all cache keys are case SENSITIVE.

So do you still think there is more? Well, there is no more, that's it, a few lines of code and you are cooking with Reactor.

Security Interceptor Updates

  • The property useRoutes has now been deprecated as it is automatically calculated.

SES Interceptor Updates

  • addCourse() is now deprecated and replaced by addRoute()
  • New view dispatcher : You can now declare views to be dispatched with no need of running events in SES mode. This is accomplished via our new view argument to the addRoute() method:
//view dispatch
addRoute(pattern='/AboutUs',view='about');
  • New method setDebugMode() which defaults to false. When enabled, the interceptor will log all of its translations and findings. Great for debugging.
  • Ability to turn on/off convention name value pairs on a per route basis by adding a new argument to the addRoute() method: valuePairTranslation (boolean), which defaults to true.
  • Performance updates are now even visible due to the evaluation of regex patterns at application startup instead of at runtime and for each route permutation.

ColdBox Main Controller Updates

The main coldbox controller which is used by the Application.cfc/cfm now has exposed methods for the locking timeouts.

  • get/setLockTimeout()

You can now also choose the name of the key used to store your running ColdBox application. By default it still uses the key: cbController, but now you can choose this by using the following methods:

  • setCOLDBOX_APP_KEY() or
  • Adding a variable called COLDBOX_APP_KEY in your Application.cfc declaration.
  • Adding a variable called COLDBOX_APP_KEY in your template that includes the coldbox.cfm bootstrapper

Deprecation of cfcUnit support

cfcUnit support has now been deprecated in favor of MXUnit.

Model Integration Updates

  • You can now use the keyword singleton in the cfcomponent tag to simulate a singleton instance.
  • New interception point: afterModelCreation that can be used to post-process objects after creation and dependency injections.
  • Factory now respects defaults on constructor arguments
  • Factory now ignores objects that cannot be located or found
  • Debug mode is now enhanced to reflect more data

Query String Support on setNextRoute

You can now use query string arguments on setNextRoute calls.

Request Context Updates

These are the updates on the request context object:

  • buildLink() now supports a query string argument for building ses or non-ses query strings.
  • getHTTPMethod() : method gives you the currently executing http method.

Event Handler Updates

Pre/Post Interceptors Updated

These local interceptors now take in the current executing action they are intercepting as a new argument called: action

<!--- preHandler --->
<cffunction name="preHandler" returntype="void" output="false" hint="Executes before any event in this handler">
        <cfargument name="event" required="true">
        <cfargument name="action" hint="The intercepted action"/>
        <cfscript>      
                var rc = event.getCollection();
        </cfscript>
</cffunction>

<!--- postHandler --->
<cffunction name="postHandler" returntype="void" output="false" hint="Executes after any event in this handler">
        <cfargument name="event" required="true">
        <cfargument name="action" hint="The intercepted action"/>
        <cfscript>      
                var rc = event.getCollection();
        </cfscript>
</cffunction>

Handler Action HTTP Security

All event handlers can now declare a public variable called allowedMethods (struct) that contains a map of allowed methods and their appropriate HTTP methods. This has been done to provide a nice way to secure RESTful API's built on ColdBox. You can now control what HTTP method operations can be done on specific handler actions. Let's say we want to protect our actions on our handler, delete(),add() and index() with different http methods.

action allowed methods
delete delete
add get,post
index get
//public property to allow method executions
this.allowedMethods = {delete='delete', add='get,post', index='get'};

Testing Updates

  • New public property for telling the testing framework to load a mock coldbox application or not when testing: loadColdbox (boolean). This defaults to true. So if you want to use the BaseTestCase? for unit testing model objects, you can do so very easily, by just saying this.loadColdbox = false.
function setup(){
  this.loadColdBox = false;
  super.setup();
}
  • New method: querySim() that enables you to simulate ANY query thanks to Jamie Jackson.

Performance Updates

  • Lock optimizations on ColdBox dispatcher have improved performance and avoids lock downs.
  • Railo now runs ColdBox in multi-threaded mode
  • preEvent security optimized
  • SES expressions are now evaluated at startup instead of in EACH request, extreme improvement on performance for SES translations.