ColdBox Reaches 2.6 Final Release
Posted on July 21, 2008 at 2:28 AM in ColdBox, ColdFusion
Luis Majano announced that ColdBox hit 2.6 Final Release today. This release boasts a number of new features. Here is a quick overview of some of my personal favorites:
Application-Defined Conventions
The new <Conventions> block in the coldbox.xml file allows you to define your own application directory structure.
onMissingAction() Method
This one has so many possibilities that it's mind-boggling. This really opens up the avenues to rich applications and code reuse. Just as a quick example, think about the following tasks:
- Add a User Email Address - index.cfm/user/addEmailAddress
- Add a User Phone Number - index.cfm/user/addPhoneNumber
With onMissingAction() you can now utilize a generic add() method in a utilities handler, and never even write an addEmailAddress() or addPhoneNumber() method in your user handler. When the request hits user/addEmailAddress, onMissingAction() will pick up the request where you can then define the object type and all that good stuff, and send the request over to your generic add().
SES Numeric Routes
- addCourse(
- pattern: "blog/entry/:month-numeric/:year-numeric"
- );
By adding "-numeric" to the :month and :year placeholders, you can know that those variables will be numeric.
SES Optional Variables
With a simple question mark (?) you can now define optional variables in your SES routes.
- addCourse(
- pattern: ":handler/:action?/:id?"
- );
A single route now matches three different patterns. Less code, more action. I dig it.
SES Name-Value Pairs
This one seems so simple that it's amazing that it's brand new in 2.6, but it is indeed new, and I like it. In ColdBox 2.5.x you had to either write umpteen bazillion courses (patterns), or you had to combine the base pattern (e.g. :handler/:action/:id) with your standard querystring separators (e.g. ?foo=bar). Thanks to this new enhancement, anything left over from the matched pattern will be converted to name:value pairs. Take this example:
- addCourse(
- pattern: ":handler/:action?/:id-numeric?"
- );
If the request is directed to
index.cfm/user/list/page/1/sort/asc
the :handler and :action? part of the course will match, but everything else (page/1/sort/asc) is "left over". Those leftovers will be converted to a variable named 'page' with a value of '1', and a variable named 'sort' with a value of 'asc'.
Summary
These are just a select few of the ColdBox 2.6 enhancements. Be sure to check out the complete What's New? list.
Latest Articles
- No recent entries.
Categories
- ColdBox (21) [RSS]
- ColdFusion (92) [RSS]
- Fusebox (3) [RSS]
- General (22) [RSS]
- jQuery (15) [RSS]
- Kalendar (1) [RSS]
- Linux (1) [RSS]
- Mura CMS (1) [RSS]
- Railo (1) [RSS]
- Rants (5) [RSS]
- Transfer (8) [RSS]
- Uni-Form Tag Library (36) [RSS]
Quick Links
Blogs I Read
Calendar
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
« Oct | ||||||
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Subscribe
Enter a valid email address.
On 7/22/08 at 5:58 PM, ike said:
granted that the upcoming (not yet released) version of the framework makes it a little easier because I made both the base template and the _process.cfm template optional, but the fundamental nature of the front-controller in the onTap framework from the very beginning, way back even long before there was such a thing as a CFC (CF5), made these things easy to do...
That's the advantage of a flexible or dynamic front-controller instead of a rigid/static "index.cfm" front-controller. Well, that and Application.cfc because otherwise you have to actually create the base templates -- onMissingTemplate allows you to omit copying those.