Blog

ColdBox Platform 3.5.0 Released!

Luis Majano March 27, 2012

Spread the word

Luis Majano

March 27, 2012

Spread the word


Share your thoughts

We are so proud to announce the 3.5 final version of the ColdBox Platform!  After almost 9 months of development, research and testing, we are ready for more great stuff to come.  There are tons and tons of fixes and updates in the release, which actualy makes it the fastest ColdBox release ever (Especially under Railo, wow it is fast, with vanilla framework requests executing at 1ms!).  So let's look at some resources for you:

This release includes some great deprecations as we finally dropped compatibility with Coldfusion 7 which gave us a fresh start and a huge performance boost.  We also deprecated lots of stuff that where lying around in the core since inception.  So if you are upgrading from older versions, please make sure to follow our upgrade guide.  So before we look at some of the major features and updates of this release, here is a breakdown of what is gone.

Removals & Migrations

So now that we have the old baggage out the window, let's talk about a handful of features that make 3.5 an outstanding release.  To read more about the release, we encourage you to check out the What's New Guide!

Validation Engine: ValidBox

That's right, we now have our own server side validation engine for objects, ORM entities and even forms with tons of cool core validators.  We formally call this library, ValidBox, and it will also be a standalone library soon.  Check out the validation page to see what you can do with it, from using closures, custom validators, to i18n messaging.

No More XML

Starting with ColdBox 3.5, the entire application is configured with a single CFC, that can give you environment control, event broadcasting and so much more.

Module Enhancements

Modules have become one of the best features of ColdBox, where you can partition a monolithic application into reusable and decoupled set of modules or mini ColdBox applications.  They have matured over the years and this release includes things like:

  • Delegated environment control, so when your environment functions fire in your parent, they also fire in the modules as well.
  • Setting of layouts or views can now be from a module as well.
  • You can load modules a-la-carte from ANY location in the server.
  • Extended WireBox to allow you to talk to modules for their settings and configuration options.
  • Ability to have routing files, yes more than 1, for a module and use our URL mapping DSL for more granular control.

Security Interceptor URL Matching

The security interceptor has a new element for its rules called match, which alows you to tell the interceptor if the incoming rule should match a ColdBox event or now an incoming URL pattern.  So now you can fully detect incoming URLs and secure them as you see fit.

RESTFul & Rendering Enhancements (JSONP/PDF)

ColdBox 3 introduced great enhancements for creating RESTful services with ColdBox.  From format detection, to marshalling of content, HTTP method security, URL HTTP Method Mapping, and so much more.  3.5 introduces great new rendering updates, caching updates and more URL RESTFul mapping strategies that will allow you to build sustainable RESTful services in no time.

You can now produce JSONP packets with renderdata() by providing callbacks

event.renderData(type="jsonp", data=data, jsonCallback="myCallback");

PDF generation is a zinch with ColdBox 3.5, you can produce it from any layout/view or string or from actually binary as well.

// from binary
function pdf(event,rc,prc){
  var binary = fileReadAsBinary( file.path );
  event.renderData(data=binary,type="PDF");
}

// from content
function pdf(event,rc,prc){
  event.renderData(data=renderView("views/page"), type="PDF");
}

You can now also build your own data marshalling and transform your views as you see fit with our $renderdata conventions:

event.renderData(type="plain", data=myCFC, contentType="text");
component accessors="true"{

	property name="name";
	property name="age";
	property name="cool";
	
	function init(){ return this; }
	
	function config(name,age,cool){
		setName( arguments.name );
		setAge( arguments.age );
		setCool( arguments.cool );
		return this;
	}
	
	function $renderdata(){
		var d = {
			n = variables.name,
			a = variables.age,
			c = variables.cool,
			today = now()
		};
		
		return d.toString();
	}

}

 

All events that use renderData() can be cached now with their apprioate content types so you can cache json, jsonp, pdf, xml and when re-created by the cache, all the right content types are maintained.  This is huge for RESTful services as they can now take advantage of event caching in ColdBox with correct re-creations.

URL Mapping Enhancements

As mentioned before, our URL mapping DSL has expanded and we have great stuff for mapping URLs in your applications.  You can now include more than one routing template, great for granularity and control using our includeRoutes() method or when developing modules, you can pass in an array of locations.

includeRoutes('/config/mypackageRoutes')
.includeRoutes('/config/adminRoutes');

Mapping With closures, are some cool context methods to allow for the prefixing of any of the addRoute() arguments by using what we call with closures. This allows you to prefix repetitive patterns in route declarations. The best way to see how it works is by example, the old way:

addRoute(pattern="/news", handler="public.news", action="index");
addRoute(pattern="/news/recent", handler="public.news", action="recent");
addRoute(pattern="/news/removed", handler="public.news", action="removed");
addRoute(pattern="/news/add/:title", handler="public.news", action="add");
addRoute(pattern="/news/delete/:slug", handler="public.news", action="remove");
addRoute(pattern="/news/v/:slug", handler="public.news", action="view");

The new way:

with(pattern="/news", handler="public.news")
	.addRoute(pattern="/", action="index")
	.addRoute(pattern="/recent", action="recent")
	.addRoute(pattern="/removed", action="removed")
	.addRoute(pattern="/add/:title",  action="add")
	.addRoute(pattern="/delete/:slug", action="remove")
	.addRoute(pattern="/v/:slug", action="view")
.endWith();

It provides a context for your routes by just concatenating them with the with closure.  This is a great way to group routes in nice bundles and even namespace them.  We didn't stop there, so we created also URL namespaces in ColdBox 3.5, which are essential to RESTful services.  Namespaces are cool groupings of routes according to a specific URL entry point. So you can say that all URLs that start with /testing will be found in the testing namespace and it will iterate through the namespace routes until it matches one of them. Much how modules work, where you have a module entry point, now you can create virtual entry points to ANY route by namespacing it. This route can be a module a non-module, API, package, or whatever you like.

addNamespace(pattern="/testing", namespace="test");
addNamespace(pattern="/news", namespace="blog");

Once a namespace is registered you can add routes to it via the addRoute() method or the with() closure.

// Via addRoute
addNamespace(pattern="/news", namespace="blog")
	.addRoute(pattern="/",handler="blog",action="index",namespace="blog")
	.addRoute(pattern="/:year-numeric?/:month-numeric?/:day-numeric?",handler="blog",action="index",namespace="blog");

// Via with closure
addNamespace(pattern="/news", namespace="blog");
with(namespace="blog", handler="blog")
	.addRoute(pattern="/",action="index")
	.addRoute(pattern="/:year-numeric?/:month-numeric?/:day-numeric?",action="index");
.endWith();

ORM Services

Our ORM services have grown in 3.5 thanks to all the ORM work we have been doing and they have gotten so much powerful.  We introduced two new members to the ORM family: ActiveEntity and Hibernate Criteria Builder.  You can now create awesome looking entities that can be powerful enough to query themselves, save, delete, find,  and even validate themselves.  Or you can create complex object oriented HQL with our Hibernate Criteria Builder, that can even do ORM searches for you.  We also fine tuned all our services to work with multiple datasources as well and even give you Hibernate metadata about your session, cache and even table metadata.  If you are doing all your ORM work manually, you need to take a look at our ORM services.  Not only that, you can even use the ORM services outside of ColdBox by leveraging WireBox standalone.

// Base ORM Service
c = newCriteria( 'entityName' );
// Virtual
c = newCriteria();

// Examples
var results = c.like("firstName","Lui%")
     .maxResults( 50 )
     .order("balance","desc")
     .and( 
          c.restrictions.between( "balance", 200, 300),
          c.restrictions.eq("department", "development")
     )
     .list();

// with pagination
var results = c.like("firstName","Lui%")
     .order("balance","desc")
     .and( 
          c.restrictions.between( "balance", 200, 300),
          c.restrictions.eq("department", "development")
     )
     .list(max=50,offset=20);

// more complex
var results = c.in("name","luis,fred,joe")
     .OR( c.restrictions.isNull("age"), c.restrictions.eq("age",20) )
     .list();
user = entityNew("User");
usersFound = user.count();

coolUser = user.new( {firstName="Luis",lastName="Majano",Awesome=true} );
coolUser.save();

luis = user.get("123");

With that, these are our major updates in 3.5 that we hope you enjoy!

Add Your Comment

Recent Entries

ColdBox 7.2.0 Released

ColdBox 7.2.0 Released

ColdBox, a widely used development platform for ColdFusion (CFML), has unveiled version 7.2. Packed with compelling new features, bug fixes, and enhancements, this release is designed to empower developers by boosting productivity, refining scheduled task capabilities, and enhancing the overall reliability and efficiency of application development. This article will delve into the key highlights of ColdBox 7.2 and elucidate how these advancements can positively impact developers in their daily coding endeavors.

Luis Majano
Luis Majano
November 20, 2023
Into the Box 2023 Series on CFCast

Into the Box 2023 Series on CFCast

Excitement is in the air as we unleash the highly anticipated ITB 2023 series exclusively for our valued CFCast subscribers – and the best part? It's FREE for CFCast members! Now is the perfect time if you haven't joined the CFCast community yet. Plus, we've got an incredible End-of-Year deal that's too good to miss

Maria Jose Herrera
Maria Jose Herrera
November 20, 2023
Ortus Deals are Finally Here!

Ortus Deals are Finally Here!

The much-anticipated Ortus End-of-the-Year Sale has arrived, and it's time to elevate your development experience! Whether you're a seasoned developer, a tech enthusiast, or someone on the lookout for top-notch projects, Ortus has something special in store for you. Brace yourself for incredible discounts across a wide array of products and services, including Ortus annual events, books, cutting-edge services, and more.

Maria Jose Herrera
Maria Jose Herrera
November 15, 2023