ColdFusion MX Server: New Features

Welcome to Macromedia ColdFusion® MX, the rapid server scripting environment for creating rich Internet applications.

ColdFusion MX brings the proven ease of use and productivity of ColdFusion to the highly scalable, standards-based Java technology architecture. ColdFusion MX offers innovations for creating rich Internet applications and working with XML, web services, and the Microsoft .NET Framework.

Some of the more exciting new features in ColdFusion MX include:

While frequently cited, these are certainly not the only new features or enhancements to existing features in the product. This document provides a look at these and many of the lesser-known features of ColdFusion MX.

For an element-by-element overview of changes to the CFML language, click here.

New Language Innovations

Feature Description
ColdFusion Components Using the revolutionary new ColdFusion Components capability of ColdFusion MX, you can easily encapsulate and reuse code to create well-structured applications that can be automatically accessed as web services or as remote services for Macromedia Flash clients using the integrated Macromedia Flash Remoting service.
XML Support Applications can integrate with XML just like any other data source using built-in document parsing, XSL transformations, and automated serialization of data into XML.

ColdFusion MX treats XML as a CFML data type, using concepts and syntax familiar to anyone who has used ColdFusion arrays and structs. XML documents can now be easily imported, queried, transformed, modified and manipulated in ColdFusion MX applications. In addition, a CFXML tag has been added, used to create entire XML documents in an innovative manner. Also, CFDUMP can now be used in conjunction with XML document trees and their elements (similar to dumping a structure).

Native Flash Connectivity
Included as a native service within ColdFusion MX, Macromedia Flash Remoting enables ColdFusion developers to easily deliver remote services to Macromedia Flash clients. Using ColdFusion Components or the new support for server-side ActionScript, developers familiar with ColdFusion or Macromedia Flash can easily create applications that combine the responsiveness and functionality of client/server applications with the reach and low cost deployment of the Internet.
Web Services
Invoke web services from your applications with a single line of code or publish your own using ColdFusion Components and a standards-based web services engine.

New Deployment Options

Feature Description
Hosting Security Secure shared hosting environments now have more control over resources that can be locked. Administration of sandboxes has been simplified. Sandbox administration also no longer requires a server restart after modifications are made.
Simplified Locking Speed up high volume applications with shared variable locking and simplified locking configuration with shared in-memory variables.

All scopes are internally synchronized, so you no longer need to use locking to ensure system stability as in previous versions of ColdFusion. You do, however, need locking for race condition situations. For example, if you want to say App.Foo = App.Foo + 1, you should lock it so that no other process runs the code at the same time.

Verity Improvements Take advantage of some of the new Verity search engine enhancements in ColdFusion MX.

Overview of enhancements:

  • Detailed Verity Collection page in the ColdFusion Administrator that lists every collection that is registered by ColdFusion MX and the Verity K2Server.
  • Enhanced Verity VSpider integration in ColdFusion MX to support custom fields and search results.
  • Detailed Verity Server page in the ColdFusion Administrator for configuring the K2Server and for viewing the current K2Server status and properties (address, port, online, broker, current document count, document count limit).
  • ColdFusion MX now caches the list of collections registered with the K2Server and displays the most recent collection list even when the K2Server is offline.
  • Enhanced Verity error reporting to include a textual message in addition to the Verity error number.
  • Enhanced support to automatically detect when to use the K2Server to search a set of collections.
  • Enhanced support for the Verity Query Language and 'explicit' syntax.
  • Enhanced features in the CFCOLLECTION tag; "action=list" which is now the default action and returns a query table of all of the Verity collections registered with ColdFusion MX and the K2Server as well as each collection properties. This is needed because ColdFusion MX does not use the registry to store Verity collection information as was the case in ColdFusion 5.
  • Automatic detection when creating collections to 'map' to existing collections on disk as needed. The CFCOLLECTION tag attribute "action=map" is no longer needed. This greatly simplifies a confusing, error-prone, and difficult concept.
  • Enhanced support for external collections in the Verity Collection Index page in the ColdFusion Administrator.
  • Automatic detection of whether a collection is external or internal when indexing (CFINDEX) and searching (CFSEARCH) collections. The "external" attribute is no longer needed in the CFINDEX and CFSEARCH tags.
  • Enhanced support in the CFSEARCH tag to allow mixing internal and external collections in a single search.
  • Enhanced support for detecting the state of a K2Server and providing error messages to indicate that a given search can not be completed because the K2Server is offline or the user has not configured ColdFusion MX to connect to the K2Server.


The CFCOLLECTION tag now has "list" for the action attribute, which is the default value; and a "name" attribute, which is required for the list action, to name the output query. The action attribute is now optional. All collections that are registered by ColdFusion and by the K2Server display in the query table rows.

The query table has the following columns:

  • NAME - the name of the CF registered collection or the alias collection name for the K2Server registered collection. ColdFusion MX saves the K2Server registered collection information, so it is available even when the K2Server is not running.
  • REGISTERED - "CF" if the collection is registered by ColdFusion, or "K2" if the collection is registered by the K2Server.
  • PATH - the path to the collection. If the collection is external or registered by the K2Server, the path includes the collection name.
  • MAPPED - for CF collections only. "YES" or "NO" if the collection is mapped or not.
  • EXTERNAL -"YES","NO","NOT FOUND" if the collection is external, internal, or not reachable.
  • LANGUAGE - for CF collections only. The language used by the collection.
  • ONLINE - "YES" or "NO" if the collection is available for searching or not. For K2, "NO" means there is no connection to the K2Server. For CF, "NO" means that the collection is not reachable (External will also indicate "NOT FOUND")


ColdFusion MX has added the following CFML functions related to the Verity K2 Server:

IsK2ServerOnline()
IsK2ServerABroker()
GetK2ServerDocCount()
GetK2ServerDocCountLimit()
IsK2ServerDocCountExceeded ()

Enhanced Integration Options

Feature Description
Internationalization
Build applications that support character-based languages such as Chinese, Japanese, or Korean with support for UNICODE encodings.

Locale-specific functions produce the same results across platforms, using the Java standard locales.

Also, a new function, setEncoding(scope, encoding) has been added: It sets the character encoding of input Form and URL scope variable values; used when the character encoding of input is anything other than Latin-1.

JSP/Servlet Support Create hybrid Internet applications that combine ColdFusion pages, Java Server Pages, and servlets by leveraging the built-in servlet engine.
  • ColdFusion pages can invoke JSP pages and servlets.
  • JSP pages can invoke ColdFusion pages.
  • ColdFusion pages, JSP pages, and servlets can share data in the Request, Session and Application scopes.
JSP Tag Library Importing via CFIMPORT
Call JSPs or servlets directly from within a CFML page or import JSP tag libraries and use them just like ColdFusion custom tags using the new CFIMPORT tag.

The CFIMPORT tag lets you import a JSP tag library into a ColdFusion page. Once imported, you reference the JSP tags using <prefix:tagname> syntax. You set the prefix in the CFIMPORT tag. To use JSP custom tags in your ColdFusion pages, follow these steps:

1. Place your JSP tag library JAR file, such as myjsptags.jar, into the wwwroot/WEB-INF/lib directory.\
2. Insert the following code at the top of a CFM page:

<CFIMPORT prefix="mytags" taglib="/WEB-INF/lib/myjsptags.jar">

The JSP tag library is now available to use in your CFM page. To reference a JSP tag from this jar file, use the following syntax:

<CFOUTPUT>
<mytags:helloTag message="#mymessage#" />
</CFOUTPUT>

Note: You must insert the CFIMPORT tag at the top of every page that uses tags from the JSP tag library. Placing CFIMPORT into application.cfm or in an included page does not propagate the import.

Enhanced Java Integration CFOBJECT is now faster, more reliable, and more flexible! ColdFusion MX provides simplified access to Java objects with native Java connectivity.

The support for using Java objects in ColdFusion applications has been considerably improved in ColdFusion MX. ColdFusion 5 was not built on a Java foundation, and therefore did not treat Java objects in a native manner. ColdFusion MX, on the other hand, does treat Java objects natively, offering better performance, some new enhancements, and better stability.

A few examples:

  • Java collections work like ColdFusion types (java.util.Map is like Struct, java.util.List is like Array, and so on)
  • ColdFusion MX works with all Java primitive types including 64-bit longs
  • JavaBeans properties can be accessed using natural syntax:

    x = bean.property; // same as x = bean.getProperty()
    bean.property = x; // same as bean.setProperty(x)
Integrate with .NET Integrate your application with existing Microsoft applications or new applications using the web services support in ColdFusion MX for the .NET Framework.
Mail Enhancements
Spooling of mail can be turned off, allowing mail to be run on a memory queue. This allows mail to be sent faster. The mail implementation in ColdFusion MX also uses the java.mail API, ensuring full standards compliance.
Accessibility Easily build Section 508-compliant web sites by creating reusable accessibility templates or leveraging a 508-compliant ColdFusion administrator.

An increasingly common requirement for development projects is compliance with Section 508 guidelines. The ColdFusion Administrator is 508-compliant, allowing you to more easily create 508-compliant ColdFusion projects.

Accelerated Development

Feature Description
Multiple Custom Tag Paths Organize your custom tags with ColdFusion MX!

You can now specify multiple custom tag paths in a ColdFusion application. ColdFusion MX now allows you to do this using the CFIMPORT tag.

To import a custom tag directory, use the command:

<CFIMPORT prefix="prefix" taglib="/directoryname"> at the top of your calling template to gain access to all of the tags in the directory.

To call a custom tag located in this directory, you use syntax <prefix:tag name attr1=val1 attr2=val2 ... >

Example:
You create directory "mytags" in your applications' directory and place a number of custom tags in it, including a tag called "dostuff.cfm".

To import these tags for use in your application, you use the following at the top of your calling template:
<CFIMPORT prefix="john" taglib="/mytags">

To call your dostuff tag, you simply call:
<john:dostuff>

When using CFIMPORT, you don't use "cf_" as the prefix, you use "prefix:".

Note: The CFIMPORT statement must be declared on the page where you use the custom tags.

Code Compatibility Analyzer Simplify migration from a previous release by automatically identifying deprecated tags and other issues in existing CFML pages.

You can access the Code Compatibility Analyzer from the ColdFusion Administrator. Try running your existing applications through it to detect any possible incompatibilities with ColdFusion MX. You should read the Migrating ColdFusion Applications documentation for information on migrating your applications from ColdFusion 5 to ColdFusion MX.

Integrated Development Web Server
Get your development project started more easily using the bundled ColdFusion MX HTTP server.

ColdFusion MX includes its own web server that you can use to develop ColdFusion MX applications without depending on an external Web server, such Internet Information Services, Apache, or iPlanet. While Macromedia does not recommend using the ColdFusion MX web server in production environments, it more than meets the need for a development Web server.

Improved Charting and Graphing ColdFusion MX allows graphing of multiple data sets, offline batch graph generation, more chart formats than ColdFusion 5, advanced data formatting options and much more. New tags include CFCHART, CFCHARTSERIES, and CFCHARTDATA.

Note: The CFGRAPH tag has been deprecated in ColdFusion MX. This means that the functionality will still work in this release of ColdFusion MX, but the CFGRAPH tag will not be supported in future releases. Some existing CFGRAPH attributes are not used by ColdFusion MX. We strongly recommend that developers use the new CFCHART, CFCHARTSERIES, and CFCHARTDATA tags for all charting.

Improved Regular Expressions Simplify string parsing and manipulation with new Perl-compatible regular expressions.

Many types of regular expression technologies are available to programmers. JavaScript, Perl, and POSIX are all examples of different regular expression technologies. Each technology has its own syntax specifications and are not necessarily compatible.

ColdFusion supports regular expressions that are Perl compliant with a few exceptions:

  • A period, ., always matches new lines.
  • In replacement strings, use \n instead of $n for backreference variables. ColdFusion escapes all $ in the replacement string.
  • You do not have to escape backslashes in replacement strings. ColdFusion escapes them, with the exception of case conversion sequences or escaped versions, such as \u or \\u.
  • Embedded modifiers ( (?i), etc. ) always affect the entire expression, even if they are inside a group.
  • \Q and the combinations \u\L and \l\U are not supported in replacement strings.
An excellent reference on regular expressions is Mastering Regular Expressions, Jeffrey E. F. Friedl. O'Reilly & Associates, Inc., 1997. ISBN: 1-56592-257-3, http://www.oreilly.com/.

Improved Exception Handling Create more reliable applications with expanded exception handling.

CFScript provides two statements for exception handling: try and catch. These statements are equivalent to the CFML CFTRY and CFCATCH tags.

Expanded Debugging and Tracing with CFTRACE Rapidly debug your application code with customizable tracing, enhanced error messages, and better output organization.
Roles-Based Security Secure your applications quickly using the new role-based security model that offers a flexible framework for security in your applications. Users can be authenticated and authorized against any ColdFusion data source, including Active Directory, LDAP servers, and relational databases.
Query of Queries Enhancements ColdFusion MX builds on the query of queries support introduced in ColdFusion 5. All of the new features are SQL-compliant, except alias support.

ColdFusion MX supports the following alias substitutions:

ORDER BY clause:
Example: Select (job_id + job_lvl)/2 as x, job_id from A order by x

GROUP BY clause:
Example: Select lorange+hirange as x, count(hirange) from A group by x

HAVING clause:
Example: Select (lorange+hirange)/2 as x from A group by x having x > 10000

Like ColdFusion 5, ColdFusion MX does not support aliases for table names. ColdFusion MX throws a syntax error exception, whereas ColdFusion silently produces an incorrect result set.

ColdFusion MX supports arbitrary expressions to be grouped

ColdFusion 5 only supports simple column references.
Example: select (lorange+hirange)/2 as x, count(*) from A group by x
The above select statement will succeed in ColdFusion MX, while ColdFusion 5 produces an error.

Arbitrary expressions in aggregate functions

ColdFusion MX supports aggregate functions of any arbitrary expression. ColdFusion 5 only supports simple column reference aggregates.

Example: select lorange, count(lorange+hirange) from A group by lorange

The select statement correctly executes in ColdFusion MX. ColdFusion 5 produces only the lorange column, excluding the count column.

Aggregate functions in arbitraty expressions

ColdFusion MX supports arithmetic expression that includes aggregate functions. ColdFusion 5 does not support aggregate functions in arithmetic expressions.

Example: select MIN(lorange) + MAX(hirange) A group by lorange

LIKE conditional

ColdFusion MX supports the following syntax: LIKE pattern [ESCAPE 'escape_char']
ColdFusion MX adheres to the following pattern:
underscore (_)
percent (%)
[] any character in the range (New in ColdFusion MX)
[^] any character not in the range (New in ColdFusion MX)
Example: select lname from A where lname like 'A[^c]%'

Case insensitive matching

While both ColdFusion 5 and ColdFusion MX perform case-sensitive matching on strings, ColdFusion MX supports two additional string functions, UPPER() and LOWER(), that can be be used for case insensitive matching.

Adding and subtracting DATE types

ColdFusion MX supports adding and subtracting date types.
Example: Select termination_date - hire_date from A

Performance of Query of Queries has also been significantly improved.

User Defined Functions authored with CFML Tags Create User Defined Functions using the new CFFUNCTION tag! You no longer need to use CFSCRIPT to define functions.

Define a function:

<CFFUNCTION name="getEmployeesNames" >
      <CFQUERY datasource="cfsnippets" name="q">
     SELECT FirstName, LastName FROM Employees
     </CFQUERY>

     <CFRETURN q>
</CFFUNCTION>

Call it later:

<CFSET employees = getEmployeesNames()>

CFCACHE Improvements
CFCACHE is an easy way to achieve major performance gains for qualifying pages. If a page does not change for some period of time, CFCACHE can reduce server load and page load time, often dramatically. Simply place <CFCACHE timespan="n"> at the top of the page template, where n is the number of days until the cache should be "flushed", i.e. disposed of and a new one created. You may use #createTimeSpan()# in place of n if you prefer.

attribute "action" (optional):

Cache (default): Caches page on server and client.
ClientCache: Caches pages only on the client. (Recommended for personalized pages.)
ServerCache: Caches pages only on the server.
Flush: Expires cached pages.
atttribute "timespan" (optional)": Use createTimeSpan() to specify how long until the page cache expires. Alternatively you may specify a decimal representing the number of days (e.g. 1.5 = 36 hours). If you do not specify a timespan the cache will only expire when you use action=flush.

attribute "directory" (optional): Fully qualified path of the directory where the cache files are stored. Default is the base template directory. (Also known as CacheDirectory.)

attributes username, password, port, protocol: optional settings for http call to cached content.

username & password: If the page requires authentication at the web server level.
port: Default is current port.
protocol: Default is current protocol (e.g. "http" or "https")
CFCACHE will cache the page output to a temporary file (along with a cfcache.map file that it uses to keep track of the temp files). By default these files go in the base template's directory, but you may specify another one using the directory attribute.

Changes will not appear on cached pages until the cache is flushed. Thus, by default, there will be a delay of up to timespan until content changes appear. However, you can eliminate this delay by "manually" flushing the page after a change using action="flush". In the code where the content change happens, such as a database insert, add a <CFCACHE action="flush" directory="d"> where d is the abovementioned directory. If there are multiple pages cached in the directory, you can specify exactly the ones you want to flush with expireURL.

CFCACHE considers each unique URL to be a separate "page" -- e.g. http://mysite.com/view.cfm?id=1 and http://mysite.com/view.cfm?id=2 are two different pages.

Personalized pages:

By default CFCACHE caches one version of the page for all to see, which is not compatible with personalized other otherwise client/session-dependent pages. However, you may consider using action="ClientCache" for personalized pages. This mode offers only partial caching benefits, but it is compatible with personalized pages.

Secured pages:

When a new cache needs to be generated, CFCACHE uses a self-referential CFHTTP call to capture the contents of the URL. If the page is secured at the web server level, add the username & password attributes to specify a valid login for the http request. If the page is secured at the ColdFusion level, such as with CFLOGIN and Sandbox Security, you can specify passSession=true to utilize the current user's authentication to access the page (i.e. the user who happened to have browsed the page when the cache needed to be generated). However, if the page contains personalized content, be sure to heed the above instructions about using action="ClientCache", lest you cache one user's version of the page for all to see.

Compatibility:

In ColdFusion 5 the default "Cache" action only cached pages on the server. Now it also caches on the client. Theoretically client caching should be desirable whenever server caching is desirable, so this should be backward compatabile. However we still provide a "ServerCache" option, corresponding to the old "Cache" option, in the event that the developer intentionally wants only server caching.
In ColdFusion 5 the cache actions used the attribute "cacheDirectory" and the flush action used the attribute "directory". This distinction has been collpased -- either may be used for any action.
Protocol and Port default to the current URL's. In ColdFusion 5 they were always http & 80.
If the Trusted Cache setting is enabled in the admin, physical changes to the template code will not automatically flush the cache until the next CF restart.
action=flush works correctly in ColdFusion MX.

Smart Structs You can use a dot operator to automatically generate a struct and specify a struct member.

Example:

<CFSET x=StructNew()>
<CFSET x.a.b.c="hello!">

This would throw an error in ColdFusion 5. In ColdFusion MX, this creates the intermediate structs "x.a" and "x.a.b" automatically.

Other Enhancements

Feature Description
ExpandPath() ExpandPath() now works with absolute paths
Java Methods You can call Java methods that are overloaded and have the same number of arguments in ColdFusion MX
CFSETTING <cfsetting enablecfoutputonly> ... </cfsetting> can now nest.
CFAPPLICATION The CFAPPLICATION NAME attribute is now optional. If not included, it provides access to the J2EE application and session scopes.
Server Probes Server Probes are now easier to configure and have been more logically arranged in the ColdFusion Administrator.
exp() exp(0) = 1 instead of throwing an error like ColdFusion 5
Power of Zero anynumber ^ 0 = 1 instead of an error like ColdFusion 5
UNICODE Programming Elements CFML programming elements can be unicode. Includes variable names string constants, etc. <CF_(unicode name)> is valid cfml.
evaluate() Performance Evaluate() is much faster when the expression is just a variable reference.
Improved Date Functions ColdFusion MX date functions work with the Java calendar class, which is historically accurate back to circa 2000 BC (Cesarian & Gregorian calendars). ColdFusion 5 only guaranteed correctness back to the year 1900.
numberformat() numberformat() with a number that is too big no longer causes system problems.
Query Cells ColdFusion MX query cells can now contain any value, simple or complex.
ToString(), ToBase64() ToString and ToBase64() now take a second arg to specify encoding when converting
binary values and string values.

Overview of CFML Changes

This section lists the CFML tags and functions that have been added or changed in ColdFusion MX. For details, see the Migrating ColdFusion 5 Applications guide and the CFML Reference.

Tag/Function

Status

CFCOLLECTION

Changed: new name attribute and action=list

CFLDAP

Changed: sort attribute deprecated

CFLOG

Changed: thread, date, and time attributes are deprecated

CFLOOP

Changed: setting collection to a struct in cfloop is deprecated. Use structsort() instead

CFIMPORT

New: Java Interopability: Used to import JSP tag libraries

CFTRACE

New: Debugging: Helps developers debug applications.

CFXML

New: XML: Used to dynamically create XML documents using CFML

CFINVOKE

New: Components and Web Services: Executes a method on a component or Web Service 

CFCOMPONENT

New: Components: Used to define a component

CFPROPERTY

New: Components: Used to define a property of a component

CFFUNCTION

New: UDFs, Components: Create a User Defined Function via a tag or define a function in a CFC

CFARGUMENT

New: UDFs, Components: Defines an argument in a tag based User Defined Function or a CFC function

CFRETURN

New: UDFs, Components: Returns a value from a tag based User Defined Function or CFC function

CFLOGIN

New: User Security: Defines the block of code where user authentication is performed

CFLOGINUSER

New: User Security: Used to indicate that a user has been authenticated in an application

CFLOGOUT

New: User Security: Used to indicate that a user is no longer authenticated and must re-login

CFCHART

New: Charting: Create a graph

CFCHARTDATA

New: Charting: Specifies data for an individual data point

CFCHARTSERIES

New: Charting: Specifies a series of data for a chart

createObject()

Changed: Can now also be used for web services and ColdFusion components

isObject()

New: Used to query type

getMetaData()

New: Returns meta-data about an object

isXmlDoc()

New: XML: Used to query type

xmlNew()

New: XML: Create a new CFML XML object (the XML equiv. of StructNew() )

xmlParse()

New: XML: Parse an XML document into a CFML XML object

xmlTransform()

New: XML: Perform a XSLT transformation

xmlSearch()

New: XML: Perform an XPATH query on XML

xmlElemNew()

New: XML: Create a new XML node element

isXmlElem()

New: XML: Used to query type

isXmlRoot()

New: XML: Used to query type

xmlChildPos()

New: XML: Searches for the location of a child node

setEncoding()

New: internationalization: Sets the character encoding of input Form and URL scope variable values; used when the character encoding of input is anything other than Latin-1.

getAuthUser()

New: User Security: Returns the name of the current logged in user

isUserInRole()

New: User Security: Conditional function used to determine if a logged in user is in a role

The following tags are deprecated* in ColdFusion MX:

* Deprecated means that ColdFusion MX will support the use of these tags, but Macromedia does not intend to support these tags in future releases. You should look for alternatives to these tags and functions.

The dbname and dbserver parameters present in some ColdFusion 5 CFML tags such as CFQUERY are not supported in ColdFusion MX and will cause a syntax error.

ColdFusion MX no longer supports the following tags and functions:

See the documentation "Migrating ColdFusion 5 Applications" for complete details on deprecated and non-supported tags and functions.