ColdBox Platform

ColdBox is an open-source, conventions-based, modular web application framework intended for building enterprise applications with CFML using a Hierarchical MVC approach. ColdBox uses Convention over configuration and aims for simplicity, rapid development. It makes use of Model-view-controller, Dependency injection, Unit testing, Aspect-oriented programming architectural patterns. ColdBox allows for development of stand-alone modules which can be shared across apps. ColdBox is an active and heavily documented CFML framework.[2]

ColdBox Platform
Original author(s)Ortus Solutions, Corp
Initial releaseJune 15, 2006 (2006-06-15)
Stable release
5.6.1[1] / 2019-08-19[±]
RepositoryColdBox Repository
Written inCFML, Java
TypeWeb application framework
LicenseApache License v2
WebsiteColdBox.org

History

  • ColdBox was developed by Luis Majano and open sourced for the first time in 2006.
  • Since 2006 there have been over 30 releases.
  • ColdBox became a professional open source project in 2008, when professional services were offered by the parent company Ortus Solutions, Corp.
  • In 2011 it introduced Hierarchical Model View Controller as its core foundation design pattern.

Platforms

ColdBox is supported on Lucee (A popular open source CFML engine) and Adobe's Coldfusion application servers.

It has supported IDE plugins for, Visual Studio Code, Sublime Text, Eclipse IDE, and Adobe ColdFusion Builder.

Usage

Below is a list of some notable users of the Coldbox Platform.[3]

Overview

High-level attributes of ColdBox:

  • An HMVC web framework for the ColdFusion platform.
  • Modular development platform to provide HMVC architectural patterns
  • Conventions over configurations (No XML)
  • Integrates with Hibernate ColdFusion ORM
  • Offers a consistent framework aiming to reduce confusion and be easy to learn
  • Persistence abstraction layers (caching)
  • Built-in logging library
  • Built-in dependency injection and AOP capabilities
  • Internal Domain Specific Languages to define caching, DI/AOP, logging and mocking
  • Ability to do unit and integration testing
  • Ajax support which is easy to extend and customize
  • RESTful and SOAP web service support[4]
  • Adobe Flex/Air integration and monitoring
  • Provides multi-development environment capabilities
  • Prolific Documentation

Internal Frameworks

The ColdBox Platform comprises three independent frameworks:

  • LogBox - Logging Library
  • WireBox - Dependency Injection and AOP library
  • CacheBox - Caching Engine and Aggregator
  • ColdBox MVC - MVC conventions based web framework

Controllers

ColdBox is conventions-based framework that is programmed in CFML, differing from other CFML MVC frameworks that use XML declarative logic for their controllers.

Below is an example of a controller:

 1 component{
 2 
 3 	// Use Dependency injection for hibernate based virtual services
 4 	property name="userService" inject="entityservice:User";
 5 	
 6 	/**
 7 	* Return immediate HTML
 8 	*/
 9 	function sayHello(event){
10 	 	return "hello";
11 	}
12 
13 	/**
14 	* Return immediate JSON from an ORM object's memento
15 	*/
16 	function sayHello(event){
17 	 	return userService.get( rc.id ).getMemento();
18 	}
19 	
20 	/**
21 	* Return content in multiple formats
22 	*/
23 	function list(event){
24 		prc.data = userService.list();
25 	 	// render out all users in json format
26 		event.renderData( data=prc.data, formats="json,xml,pdf,html" );
27 	}
28 }

URL Mappings

ColdBox supports URL mappings and routing Rails style but adapted for ColdFusion. It also supports the creation of RESTful routing:

 1 // Resources 
 2 resource( "photos" );
 3 
 4 // Nested Resources
 5 resources(
 6 	resource 	= "agents",
 7 	pattern 	= "/sites/:id/agents"
 8 );
 9 
10 // Redirects
11 route( "/oldRoute" )
12 	.toRedirect( "/main/redirectTest" );
13 
14 // Direct Routing
15 route( "/render/:format" ).to( "actionRendering.index" );
16 
17 // With Regex
18 route( "post/:postID-regex:([a-zA-Z]+?)/:userID-alpha/regex:(xml|json)" )
19 	.to( "ehGeneral.dumpRC" );
20 
21 // subdomain routing
22 route( "/" )
23 	.withDomain( ":username.forgebox.dev" )
24 	.to( "subdomain.show" );
25 
26 // Responses + Conditions
27 route( "/ff" )
28 	.withCondition( function(){
29 		return ( findnocase( "Firefox", cgi.HTTP_USER_AGENT ) ? true : false );
30 	} )
31 	.toResponse( "Hello FireFox" );
32 route( "/luis/:lname" )
33 	.toResponse( "<h1>Hi Luis {lname}, how are {you}</h1>", 200, "What up dude!" );
34 
35 // Inline Closure Responses
36 route( "/luis2/:lname" )
37 	.toResponse( function( event, rc, prc ){
38 		return "<h1>Hello from closure land: #arguments.rc.lname#</h1>";
39 	} );
40 
41 // Views No Events
42 route( "contactus" )
43 	.as( "contactUs")
44 	.toView( "simpleView" );
45 
46 // Named routes
47 route( pattern="/routeRunner/:id/:name", name="routeRunner" )
48 	.to( "main.returnTest" );
49 
50 // Grouped Routing
51 group( { pattern="/runAWNsync", handler="utilities.AWNsync" }, function( options ){
52 	route( '/:user_id' )
53 		.withAction( { get = "runAWNsync", options = "returnOptions" } )
54 		.end();
55 } );
56 
57 // RESTFul Actions
58 route( "/health_check" )
59 	.withAction( { get = "runCheck", options = "returnOptions" } )
60 	.to( "utilities.HealthCheck" );

RESTful URLs

ColdBox allows for easy creation of RESTful URLs via URL mappings and extension detection. Natively ColdBox can detect any extension when supplied to an URI resource:

http://api.coldbox.org/rest/user/luis.json
http://api.coldbox.org/rest/user/luis.xml
http://api.coldbox.org/rest/user/luis.pdf
http://api.coldbox.org/rest/user/luis.yml

It allows for the detection of such extensions, security around them and the ability to customize the extensions.

Ajax support

ColdBox supports all JavaScript frameworks that provide Ajax capabilities. It also provides an auto-marshalling function to render any object to the following formats natively: XML, WDDX, JSON, JSONP, TEXT, PDF, CUSTOM.

SOAP-Adobe Flex/Air Support

ColdBox offers support for creating, monitoring and developing SOAP web services and Flex/Air remote components. It allows for having one development paradigm for multiple GUI interfaces.

gollark: Wait, what other tools?
gollark: On the other hand, it is at least gathering it in unintended ways, and makes it *much* easier to search.
gollark: On the one hand, it provides information which, while it's not exactly public, is... at least mostly not *private*, exactly?
gollark: Yes, I've seen it. I'm actually a bit conflicted on it.
gollark: Multiplatform access is hardly an amazing thing given that open platforms tend to have perfectly good web clients. There are ones for XMPP and IRC.

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.