Releases: ColdBox/coldbox-platform
v6.0.0
Changelog
All notable changes to this project will be documented here: https://coldbox.ortusbooks.com/intro/release-history and summarized in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[6.0.0] => 2020-AUG-20
ColdBox HMVC Core
Bugs
[COLDBOX-48] - CacheBox creates multiple reap threads if the initial one take longer to complete than the reap frequency
[COLDBOX-339] - Error in AbstractFlashScope: key does't exists due to race conditions
[COLDBOX-822] - InvalidEvent is not working when set to a module event
[COLDBOX-829] - Stopgap for Lucee bug losing sessionCluster application setting
[COLDBOX-832] - toResponse() silently fails on incorrect data types
[COLDBOX-837] - Unable to manually call invalid event method without producing error
[COLDBOX-839] - Router method and argument name discrepancy
[COLDBOX-845] - Capture request before announcing onRequestCapture
[COLDBOX-850] - XML Converter Updated invoke() to correctly call method by name
[COLDBOX-857] - ElixirPath does not take in account of module root
[COLDBOX-861] - Self-autowire fails for applications with context root configured in ColdBox Proxy
[COLDBOX-862] - when passing custom cfml executors to futures it blows up as the native executor is not set
[COLDBOX-873] - NullPointerException in ScheduledExecutor (Lucee 5.3.4.80)
[COLDBOX-875] - PopulateFromQuery : Gracefully handle out of index rownumber in populateFromQuery #450
[COLDBOX-878] - ColdBox 6 blows up if models directory doesn't exist
[COLDBOX-879] - Reinit-Password-Check does not use the new "reinitKey"-Setting
[COLDBOX-880] - ViewHelpers not working in CB-6 RC
[COLDBOX-885] - Pagination not showing from rest response
[COLDBOX-889] - RendererEncapsulator passes view-variables to "next" rendered view
[COLDBOX-891] - Whoops breaking on some exceptions
[COLDBOX-897] - Template cache eventSnippets don't match module events or event suffixes
[COLDBOX-899] - queryString argument ignored when using event in BaseTestCase#execute
[COLDBOX-903] - Renderer.ViewNotSetException when renderLayout used in request
[COLDBOX-911] - Garbled text in Whoops error screen - utf8 encoding
New Features
[COLDBOX-268] - Async Workers
[COLDBOX-749] - Performance: make renderer a singleton
[COLDBOX-848] - Improve the bug reporting template for development based on whoops
[COLDBOX-849] - Incorporate Response and RestHandler into core
[COLDBOX-851] - All ColdBox apps get a coldbox-tasks
scheduler executor for internal ColdBox services and scheduled tasks
[COLDBOX-852] - Updated the default ColdBox config appender to be to console instead of the dummy one
[COLDBOX-853] - ColdBox controller gets a reference to the AsyncManager and registers a new AsyncManager@coldbox
wirebox mapping
[COLDBOX-855] - Allow for the application to declare it's executors via the new executors
configuration element
[COLDBOX-856] - Allow for a module to declare it's executors via the new executors
configuration element
[COLDBOX-858] - Introduction of async/parallel programming via cbPromises
[COLDBOX-859] - ability to do async scheduled tasks with new async cbpromises
[COLDBOX-860] - Convert proxy to script and optimize it
[COLDBOX-863] - Add setting to define reinit key vs. hard-coded fwreinit: reinitKey
[COLDBOX-864] - jsonPayloadToRC now defaults to true
[COLDBOX-865] - autoMapModels defaults to true now
[COLDBOX-868] - RequestContext Add urlMatches to match current urls
[COLDBOX-869] - Response, SuperType => New functional if construct when( boolean, success, failure )
[COLDBOX-871] - Removed fwsetting argument from getSetting() in favor of a new function: getColdBoxSetting()
[COLDBOX-874] - BaseTestCase new method getHandlerResults() to easy get the handler results, also injected into test request contexts
[COLDBOX-876] - New dsl coldbox:coldboxSettings alias to coldbox:fwSettings
[COLDBOX-877] - New dsl coldbox:asyncManager to get the async manager
[COLDBOX-887] - Elixir manifest support for module and app roots via discovery
[COLDBOX-894] - New listen() super type and interceptor service method to register one-off closures on specific interception points
[COLDBOX-905] - The buildLink( to ) argument can now be a struct to support named routes : { name, params }
[COLDBOX-906] - Move queryString as the second argument for buildLink() so you can use it with psoitional params
[COLDBOX-907] - New context method: getCurrentRouteRecord() which gives you the full routed route record
[COLDBOX-908] - New context method: getCurrentRouteMeta() which gives you the routed route metadata if any
[COLDBOX-909] - New router method: meta() that you can use to store metadata for a specific route
[COLDBOX-910] - Every route record can now store a struct of metadata alongside of it using the meta
key
[COLDBOX-912] - Allow toRedirect() to accept a closure which receives the matched route, you can process and then return the redirect location
[COLDBOX-915] - New onColdBoxShutdown interception point fired when the entire framework app is going down
Tasks
[COLDBOX-866] - onInvalidEvent is now removed in favor of invalidEventHandler, this was deprecated in 5.x
[COLDBOX-867] - Removed interceptors.SES as it was deprecated in 5
[COLDBOX-870] - setnextEvent removed as it was deprecated in 5
[COLDBOX-872] - getModel() is now fully deprecated and removed in fvor of getInstance()
[COLDBOX-886] - elixir version 2 support removed
[COLDBOX-900] - request
and associated integration test methods are not in the official docs
Improvements
[COLDBOX-830] - Update cachebox flash ram to standardize on unique key discovery
[COLDBOX-833] - Improvements to threading for interceptors and logging to avoid dumb Adobe duplicates
[COLDBOX-841] - Change announceInterception() and processState() to a single method name like: announce()
[COLDBOX-846] - Use relocate and setNextEvent status codes in getStatusCode for testing integration
[COLDBOX-882] - Deprecate interceptData in favor of just data
[COLDBOX-892] - Please add an easily accessible "fwreinit" button to whoops...
[COLDBOX-895] - migrating usage of cgi.http_host to cgi.server_name due to inconsistencies with proxy requests that affects caching and many other features
[COLDBOX-904] - Interceptor Buffer Methods Removed
[COLDBOX-916] - Better module registration/activation logging to identify location and version
WireBox
Bugs
[WIREBOX-90] - Fix constructor injection with virtual inheritance
New Features
[WIREBOX-91] - Injector's get a reference to an asyncManager and a task scheduler whether they are in ColdBox or non-ColdBox mode
[WIREBOX-92] - New executors
dsl so you can easily inject executors ANYWEHRE
[WIREBOX-97] - New dsl coldbox:coldboxSetting:{setting} alias to coldbox:fwSetting:{setting}
Improvements
[WIREBOX-88] - Improve WireBox error on Adobe CF
[WIREBOX-93] - Rename WireBox provider get() to $get() to avoid conflicts with provided classes
[WIREBOX-94] - getInstance() now accepts either dsl or name via the first argument and initArguments as second argument
CacheBox
Bugs
[CACHEBOX-59] - Announced Events in the set() of the cacheBoxProvider
[CACHEBOX-63] - cfthread-20506;variable [ATTRIBUES] doesn't exist;lucee.runtime.exp.ExpressionException: variable [ATTRIBUES] doesn't exist
New Features
[CACHEBOX-24] - CacheBox reaper : migrate to a scheduled task via cbPromises
[CACHEBOX-60] - CacheFactory gets a reference to an asyncManager and a task scheduler whether they are in ColdBox or non-ColdBox mode
Improvements
[CACHEBOX-64] - Migrations to script and more fluent programming
LogBox
Bugs
[LOGBOX-35] - FileAppender: if logging happens in a thread, queue never gets processed and, potentially, you run out of heap space
[LOGBOX-38] - Rotate property is defined but never used
[LOGBOX-45] - Work around for adobe bug CF-4204874 where closures are holding on to tak contexts
[LOGBOX-50] - Rolling file appender inserting tabs on first line
New Features
[LOGBOX-5] - Allow config path as string in LogBox init (standalone)
[LOGBOX-11] - Allow standard appenders to be configured by name (instead of full path)
[LOGBOX-36] - Added an err()
to abstract appenders for reporting to the error streams
[LOGBOX-42] - All appenders get a reference to the running LogBox instance
[LOGBOX-43] - LogBox has a scheduler executor and the asyncmanager attached to it for standalone and ColdBox mode.
[LOGBOX-44] - Rolling appender now uses the new async schedulers to stream data to files
[LOGBOX-46] - Update ConsoleAppender to use TaskScheduler
[LOGBOX-47] - AbstractAppender log listener and queueing facilities are now available for all appenders
[LOGBOX-48] - DB Appender now uses a queueing approach to sending log messages
[LOGBOX-49] - Rolling File Appender now uses the async scheduler for log rotation checks
Improvements
[LOGBOX-37] - Improvements to threading for logging to avoid dumb Adobe duplicates
[LOGBOX-41] - refactoring of internal utility closures to udfs to avoid ACF memory leaks: CF-4204874
[LOGBOX-51] - Migrations to script and more fluent programming
v6.0.0-RC
Changelog
All notable changes to this project will be documented here: https://coldbox.ortusbooks.com/intro/release-history and summarized in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[6.0.0] => 2020-MAY
[6.0.0-RC] => 2020-MAY-15
Tasks
- COLDBOX-870 -
compatiblity
setnextEvent removed as it was deprecated in 5 - COLDBOX-867 -
compatiblity
Removed interceptors.SES as it was deprecated in 5 - COLDBOX-866 -
compatiblity
onInvalidEvent is now removed in favor of invalidEventHandler, this was deprecated in 5.x - COLDBOX-872 -
compatiblity
getModel()
is now fully deprecated and removed in favor ofgetInstance()
Added
- COLDBOX-877 - New dsl
coldbox:asyncManager
to get the async manager - COLDBOX-876 - New dsl
coldbox:coldboxSettings
alias tocoldbox:fwSettings
- COLDBOX-874 -
BaseTestCase
new methodgetHandlerResults()
to easy get the handler results, also injected into test request contexts - COLDBOX-860 - Convert proxy to script and optimize it
- COLDBOX-871 -
compatiblity
Removedfwsetting
argument fromgetSetting()
in favor of a new function:getColdBoxSetting()
- COLDBOX-848 - Improve the bug reporting template for development based on whoops
- COLDBOX-869 - Response, SuperType => New functional if construct
when( boolean, success, failure )
- COLDBOX-868 - RequestContext Add
urlMatches
to match current urls - COLDBOX-865 -
compatiblity
autoMapModels
defaults to true now - COLDBOX-864 -
compatiblity
jsonPayloadToRC
now defaults to true - COLDBOX-863 - Add setting to define reinit key vs. hard-coded fwreinit:
reinitKey
- COLDBOX-859 - ability to do async scheduled tasks with new async cbpromises
- COLDBOX-841 -
compatiblity
Change announceInterception() and processState() to a single method name like: announce() - COLDBOX-882 -
compatiblity
Deprecate interceptData in favor of just data - LOGBOX-46 - Update ConsoleAppender to use TaskScheduler
- LOGBOX-47 - AbstractAppender log listener and queueing facilities are now available for all appenders
- LOGBOX-48 - DB Appender now uses a queueing approach to sending log messages
Fixed
- COLDBOX-861 - Self-autowire fails for applications with context root configured in ColdBox Proxy
- COLDBOX-873 -
NullPointerException
in ScheduledExecutor (Lucee 5.3.4.80) - COLDBOX-878 - ColdBox 6 blows up if
models
directory doesn't exist - COLDBOX-875 - Gracefully handle out of index row number in populateFromQuery #450
- COLDBOX-862 - when passing custom cfml executors to futures it blows up as the native executor is not set
- COLDBOX-879 - Reinit-Password-Check does not use the new "reinitKey"-Setting
- COLDBOX-880 - ViewHelpers not working in CB-6 RC
Info
- What's New: https://coldbox.ortusbooks.com/intro/release-history/whats-new-with-6.0.0
- Upgrade Guide: https://coldbox.ortusbooks.com/intro/release-history/upgrading-to-coldbox-5
[6.0.0-BETA] => 2020-APR-20
- Beta release of ColdBox 6. Check out the What's new guide for all issues: https://coldbox.ortusbooks.com/intro/release-history/whats-new-with-6.0.0
v5.6.2
Release notes - ColdBox Platform - Version 5.6.2
Bug
- [COLDBOX-804] - ColdBox XML RenderData always lowercases tag names
- [COLDBOX-816] - lowercase cgi.server_name (returns empty when preservecaseforstructkey) is enabled on Adobe
- [COLDBOX-817] - Colon in URL throws exception when trying to find non-existent module layout
Improvement
- [COLDBOX-819] - Wirebox constructor errors swallow the whole stack trace
- [COLDBOX-820] - Elixir methods now take in a manifestRoot argument so you can override the root location
- [COLDBOX-821] - Encode output on exception template to avoid any xss issues for exceptions
Release notes - CacheBox - Version 5.6.2
Bug
- [CACHEBOX-57] - LuceeProvider overwrites cacheName config property with default
- [CACHEBOX-58] - Left over typo from script conversion on lucee stats
v5.6.0
What's New With 5.6.0
ColdBox 5.6.0 is a minor version update with lots of fixes, improvements, performance enhancements and some nice new features. Below are the major areas of improvement and the full release notes. To update ColdBox or any of the standalone libraries just leverage CommandBox:
update coldbox
update logbox
update wirebox
update cachebox
Major Updates
Performance
We had two specific tickets that have resulted in extreme performance improvements for ALL ColdBox requests. You will feel and see the difference:
- [COLDBOX-799] - Event Handler Bean: Single instance per handler action for major performance improvements
This ticket was contributed by Dom Watson (https://twitter.com/dom_watson) one of the lead engineers of the amazing PresideCMS project built on top of ColdBox. We worked together to avoid the creation of handler beans on each runnable event. We now cache each event handler bean representation which results in an extreme boost in performance. Thanks Dom!
- [COLDBOX-810] - Remove afterInstanceAutowire interceptor in handlerService as afterHandlerCreation is now officially removed.
Thanks to our local mad scientist Brad Wood, he reported that the handler services still listened to ALL CFC creations in an application in order to relay an afterHandlerCreation
interception point from the good 'ol 2.6 days. This has been finally removed and boom, another big boost in performance!
Better Bug Reports
We have enhanced the bug reporting templates to include much more information when dealing with exceptions:
- Show SQL error details on Adobe CF
- Current route, params and debug info
- Contributing module for the current routed URL
Merging of HTTP Verbs
Thanks to our very own Eric Peterson, you can now merge HTTP verbs on the same route pattern, which you could not do before:
router
.post( "photos/", "photos.create" )
.get( "photos/", "photos.index" )
.delete( "photos/", "photos.remove" );
ColdBox Core Release Notes
Bugs
- [COLDBOX-778] - ModuleService to add default route doesn't work correctly
- [COLDBOX-794] - Fix default bug report to show SQL error detail for adobe SQL exceptions
- [COLDBOX-796] - When doing package resolving if you are in a module it still tries to resolve a module
- [COLDBOX-806] - Error in HTML helper WRAPPERATTRS doesn't exist in argument scope
- [COLDBOX-811] - Include the colon for non 80 or 443 port numbers #419 in github
New Features
- [COLDBOX-812] - Allow merging of HTTP verbs when doing separate verbs for the same route
- [COLDBOX-813] - Update cfconfig to use env variables instead of inline mixins, modernizeOrDie
Improvements
- [COLDBOX-795] - Add more current route information to the BugReport.cfm template
- [COLDBOX-797] - Ability for bug reports and app to know which module contributed the incoming URL route.
- [COLDBOX-798] - Use of .keyExists() can needlessly use memory in requests, suggest StructKeyExists() instead
- [COLDBOX-799] - Event Handler Bean: Single instance per handler action for major performance improvements
- [COLDBOX-800] - HandlerService.cfc$newHandler(): declares variables that are never used
- [COLDBOX-810] - Remove afterInstanceAutowire interceptor in handlerService as afterHandlerCreation is now officially removed.
CacheBox Release Notes
Bugs
- [CACHEBOX-56] - AbstractCacheProvider.getOrSet(): local var unscoped when checking if null
v5.1.4
Bug
- [COLDBOX-718] - Left one encodeforhtml in textarea that was missing.
v5.1.3
What's New With 5.1.3
This is a patch release for ColdBox
Bugs
- [COLDBOX-715] - Elvis operator inconsistencies on Adobe Engines, please Adobe, patch the engines and fix your compiler!
Improvements
- [COLDBOX-237] - Some HTMLHelper method still need escaping as certain values should never be HTML
- [COLDBOX-716] - determine session/client state via CF getApplicationMetadata() instead of isDefined() to avoid load issues for flash ram
- [COLDBOX-717] - RemotingUtil converted to cfscript #367
v5.1.2
What's New With 5.1.2
This is a patch release for ColdBox
Bugs/Regressions
- [COLDBOX-711] - HTML helper cannot add fontawesome icons in button due to XSS enabled by default
- [COLDBOX-712] - ColdBox shutdown code that uses CF mappings for modules fails on fwreinit
- [COLDBOX-713] - addAsset throw error when called from handlers
Improvements
- [COLDBOX-714] - Too many issues when encoding by default for HTML Helper, revert to non-encoded and provide ways to encode globally and a-la-carte
HTML Helper Changes
The HTML Helper has been migrated to an internal module in this release. It allows you to configure it via the following configuration settings in your ColdBox.cfc
.
moduleSettings = {
htmlHelper = {
// Base path for loading JavaScript files
js_path = "",
// Base path for loading CSS files
css_path = "",
// Auto-XSS encode values when using the HTML Helper output methods
encodeValues = false
}
}
Injection Shortcut
You can also now inject the HTML helper anywhere using it's injection DSL Shortcut of @HTMLHelper
v5.1.1
What's New With 5.1.1
This is a patch release for ColdBox.
Bug
- [COLDBOX-703] - regression onmissingmethod on html helper method was public and changed to private
- [COLDBOX-704] - viewModule logic was not working at all yet again.
Improvement
- [COLDBOX-705] - REmove setting throwOnInvalidInterceptionStates, makes no sense anymore
- [COLDBOX-706] - Moved order of event manager states the injector provides to a ColdBox app so the binder can listen on itself
v5.1.0
What's New With 5.1.0
ColdBox 5.1.0 is a minor version update with lots of fixes, improvements and some new features. Below are the major areas of improvement and the full release notes. To update your ColdBox installation just leverage CommandBox: update coldbox
Event Caching Improvements
The event caching cleanup and clearing methods did not work when using granular query strings. This has now been resolved and optimized.
New Auto-Deserialization of JSON Payloads
If you are working with any modern JavaScript framework, this feature is for you. ColdBox on any incoming request will inspect the HTTP Body content and if the payload is JSON, it will deserialize it for you and if it is a structure/JS object, it will append itself to the request collection for you. So if we have the following incoming payload:
{
"name" : "Jon Clausen",
"type" : "awesomeness",
"data" : [ 1,2,3 ]
}
The request collection will have 3 keys for name, type and data according to their native CFML type.
Flash Scope getAll()
The flash scope needed a way to get all of its name-value pair elements in one shot, you can now with the getAll()
method.
Complete Rewrite of the HTML Helper
The HTML helper has been completely rewritten in 5.1 into script notation, optimized for performance and security. All HTML output is now XSS encoded for attributes and tag content.
View and Directory Helper Combo
You can now declare a view and directory helper and ColdBox will use them both instead of always picking the view helper only. The order of inclusion is:
- directory helper
- view helper
- view
ColdBox Fail Fast
This is a nice feature that will give your applications stability when doing deployments or production reinits. We have added a new application variable flag: application.fwReinit which is set to true when the framework is reinitializing and false when it completes. We have also added a new directive called COLDBOX_FAIL_FAST which defaults to true.
If fail fast is activated, the framework will present a nice message to users that the application is not yet available instead of holding them in a queue waiting for the reinit or application load to finish. This fail fast will release your traffic queue and produce less timeouts and failures.
The fail fast directive can also be a closure. Then we will execute your closure and you can do whatever you like within it to advice your users' about the reinit. Below you can see what happens with the fail fast code.
// Global flag to denote if we are in mid reinit or not.
cfparam( name="application.fwReinit", default =false );
// Fail fast so users coming in during a reinit just get a please try again message.
if( application.fwReinit ){
// Closure or UDF
if( isClosure( variables.COLDBOX_FAIL_FAST ) || isCustomFunction( variables.COLDBOX_FAIL_FAST ) ){
variables.COLDBOX_FAIL_FAST();
}
// Core Fail Fast Option
else if( isBoolean( variables.COLDBOX_FAIL_FAST ) && variables.COLDBOX_FAIL_FAST ){
writeOutput( 'Oops! Seems ColdBox is still not ready to serve requests, please try again.' );
// You don't have to return a 500, I just did this so JMeter would report it differently than a 200
cfheader( statusCode="503", statustext="ColdBox Not Available Yet!" );
}
return false;
}
Release Notes
Bugs
- [COLDBOX-679] - viewmodule parameter not used in system.web.renderer.renderLayout
- [COLDBOX-680] - When using Resources the POST incorrectly sets action to UPDATE instead of CREATE
- [COLDBOX-681] - AbstractFlashScope fails on autoPurge property check
- [COLDBOX-683] - Event Caching Should Include Response Headers
- [COLDBOX-686] - coldbox create app template doesn't work with a servlet context other than /
- [COLDBOX-687] - Event caching broken due to not evaluating renderdata as a valid struct thanks to the EC OIL Team (Christian,Sebastian,Didier)
New Features
- [COLDBOX-682] - Add auto-deserialization of inbound JSON payloads into the RC on request capture
- [COLDBOX-689] - New flash method: getAll() which retrieves a struct of all flash keys and their content
- [COLDBOX-693] - Complete rewrite of HTML Helper to Script
- [COLDBOX-694] - HTML Helper XSS Encodes all output from content to attributes by default
Improvements
- [COLDBOX-343] - Allow view helper AND directory helper at the same time.
- [COLDBOX-592] - Have ColdBox bootstrap advertize when Coldbox is reinitting, and have a fail fast routine
- [COLDBOX-678] - Default Flash Ram to client if session scope is disabled
- [COLDBOX-685] - Event Cache Key and Storage Enhancements to allow for granular querystring evictions
- [COLDBOX-690] - Add support for cgi.https to isSSL()
- [COLDBOX-691] - Ignore AllowedMethods when using runEvent on non-default method calls
v5.0.0
What's New With 5.0.0
ColdBox 5.0.0 is a major release for the ColdBox MVC platform. It has been long standing as we have been learning so much especially around containerization and portability. This release has over 70 key issues addressed from new features, improvements and bug fixes. So let's begin our ColdBox 5 adventure.
Global Versioning
All internal libraries have now a standard version according the the major ColdBox release of 5.0.0. Further releases of WireBox, CacheBox and LogBox will adhere to the unified version.
Engine Deprecation
It is also yet another source code reduction due to the dropping of support for the following CFML Engines:
- Adobe ColdFusion 9
- Adobe ColdFusion 10
That's right, you will need Adobe ColdFusion 11+ or Lucee 4.5+ in order to work with ColdBox 5.
Automation
We have fully automated all build processes with ColdBox 5 to include CommandBox and TestBox testing, Travis integration and a fully automated test suite that executes against ALL supported CFML engines. Our code coverage has increased due to this work dramatically. We discovered engine bugs that must have plagued our users for years. YAY for testing!
Performance Improvements & Optimizations
As we update core files we keep optimizing the source code and migrating to full cfscript. This migration has allowed us to optimize very old code into modern times with significant performance gains. We have also moved from internal Java reflection to get file information to native CFML functions since now all engines support it. Just this alone has improved vanilla requests tremendously.
WireBox object creation and manipulation has also increased due to new locking strategies in our Mixer Util. You will especially see the difference when creating many transient objects.
Lucee Full Null Support
Thanks to the community we have now full null
support for the Lucee CFML engine and up-coming Adobe 2018.
Core Framework Exception Handling
The core framework has been revised with a fine tooth comb to provide better exception messages, better helpful messages and also the ability to intercept exceptions at the framework level via normal exception handlers. You will also see that ColdBox can detect response headers now and make sure it can avoid caching exceptions when event caching is turned on. The appropriate status code will now be reported.
You will also find in the log files attempts to reinit the framework with invalid or missing passwords.
Containers + Environments Support
ColdBox introduces two new methods that are available for your ColdBox.cfc
and your ModuleConfig.cfc
objects:
getSystemProperty( name, defaultValue )
- Retrieve a Java System propertygetSystemSetting( name, defaultValue )
- Discover an environment variable either by searching system properties first and then system environment variables second.
Hint These methods are also found in the ColdBox core utility object:
coldbox.system.core.util.Util
which can be injected anywhere it is needed.
These methods will allow you to interact with docker environment variables and override settings, add new settings, and much more.
Modules, Modules and more Modules
We continue to innovate in the Hierarchical MVC (HMVC) design of ColdBox by fine-tuning the modular services and interactions. Here are the major updates to modules in ColdBox 5.
- All module interceptors are now namespaced to avoid name conflicts with other modules
- New modules injected variable:
coldboxVersion
to be able to quickly detect what version of ColdBox they are running under. This will allow you to create modules that can respond to multiple ColdBox versions.
Inherited Entry Point
All modules have had a URL entry point since the beginning: this.entryPoint = "/route"
. This entry point is registered in the URL mappings to allow for a unique URL pattern to exist for specific modules. That is great! However, in modern times and with the amount of API centric applications that we are building we wanted to introduce an easier way to build resource centric APIs.
What if our resource URLs could match by convention our module inceptions? Well, with the new inherited entry points, you can do just that. By leveraging HMVC and module inception you can now create automatic URL nesting schemas.
You can turn this on just by adding the following flag in your ModuleConfig.cfc
:
this.inheritEntryPoint = true
When the module is registered it will recurse its parent tree and discover all parent entry points and assemble the entry point accordingly. Let's see an example. We are working on an API and we want to create the following URL resource: /api/v1/users
. We can leverage HVMC and create the following modular structure:
+ modules_app
+ api
+ modules_app
+ v1
+ modules_app
+ users
This models our URL resource modularly. We can now go into each of the module's ModuleConfig
and add only the appropriate URL pattern and turn on inherit entry point.
api - this.entryPoint = /api
v1 - this.entryPoint = /v1
users - this.entryPoint = /users
This feature will not only help you identify API routing, but help you build with modularity in mind. You will also find a new method in the request context called getModuleEntryPoint()
to retrieve a modules inherited entry point, which is great for URL building.
New Module Events
You can now listen to more events of the module life-cycle:
preModuleRegistration
- before each module is registeredpostModuleRegistration
- after each module is registeredafterModuleRegistrations
- This will fire when all modules have been registered. This is great if you want modules to dynamically depend on each other.afterModuleActivations
- This will fire when all modules have been succesfully activated. Great for caching updates, announcements, etc.
Modules_app convention for inception
We have now added the modules_app
convention for all module inceptions.
Default Model Export Convention
If you create a module where there is a model with the same name, then we will automatically map it in Wirebox as @modulename
.
cors = getInstance( "@cors" )
This is great for 1 model modules.
Routing Enhancements
We continue to push forward in making ColdBox the best RESTFul framework for ColdFusion (CFML). In ColdBox 5 we have great new additions for both routing and rendering.
Simplified URL Rewrites
The SES interceptor now has a boolean flag to denote if rewrites are turned on/off and you will no longer set a base URL. We will automatically detect the base URLs according to multi-domain hosting. Meaning you can out of the box create multi-tenant applications with ease. We will also be adding subdomain routing in our final release.
setFullRewrites( true ); // defaults to false.
Named Routes
This has been a long-time coming to ColdBox and I can't believe we had never added this before. Well, named routes are here, finally!
If you have used other frameworks in other languages, they allow you to name your routes so you can build links to them in an easier manner. We have done just the same. The addRoute()
method accepts the name
parameter and we have extended the request context with some new methods:
getCurrentRouteName()
- Gives you the name of the current route, if anyroute()
- Allows you to build URLs according to named routes
Define the Route
// Create a named route
addRoute(
pattern = "/user/:username/:page",
name = "user_detail"
);
// Same for modules
routes = [
{
pattern = "/detail/:username/:page",
name = "user_detail"
}
];
Build Links
<a href="#event.route( name="user_detail", params={ username="luis", page="1" } )#>User Details</a>
The route
method signature can be seen below:
/**
* Builds links to named routes with or without parameters. If the named route is not found, this method will throw an `InvalidArgumentException`.
* If you need a route from a module then append the module address: `@moduleName` in order to find the right route.
*
* @name The name of the route
* @params The parameters of the route to replace
* @ssl Turn SSL on/off or detect it by default
*
* @throws InvalidArgumentException
*/
string function route( required name, struct params={}, boolean ssl )
Resourceful Routes
In ColdBox 5, you can register resourceful routes to provide automatic mappings between HTTP verbs and URLs to event handlers and actions by convention. By convention, all resources map to a handler with the same name or they can be customized if needed. This allows for a standardized convention when building routed applications.
You will now have a new resources()
method in the SES interceptor or a resources
struct in your modules. Yes, all modules can have their own resourceful routes as well.
// Creates all resources that point to a photos event handler by convention
resources( "photos" );
// Register multiple resources either as strings or arrays
resources( "photos,users,contacts" )
resources( [ "photos" , "users", "contacts" ] );
// Register multiple fluently
resources( "photos" )
.resources( "users" )
.resources( "contacts" );
// Creates all resources to the event handler of choice instead of convention
resources( route="photos", handler="MyPhotoHandler" );
// All resources in a module
resources( route="photos", handler="photos", module="api" );
// Resources in a ModuleConfig
resources = [
{ resource="photos" },
{ resource="users", handler="user" }
];
This single resource declaration will create all the necessary variation...