Parameter
New features & enhancements in Adobe ColdFusion
What's new and changed in ColdFusion (2018 release)
New User Interface for ColdFusion Administrator
ColdFusion Administrator now sports a cleaner, more intuitive User Interface. The interface is arranged in tabs for easy navigation. The search experience is also enhanced in this release. When you enter a search string, you can see recommendations for the search term.
For more information, see New UI for Administrator.
Performance Monitoring Toolset
The 2018 release of Adobe ColdFusion Enterprise and Standard editions now offer you the Performance Monitoring Toolset, an all-new solution that ensures that your applications are as optimized as the high-performing ColdFusion engine.
For more information, see Performance Monitoring Toolset.
Server Auto-Lockdown
Secure your ColdFusion server against vulnerabilities and other malicious attacks. Run the Auto-Lockdown tool and lock down ColdFusion instances.
For more information, see Server Auto-Lockdown.
Core language enhancements
- NULL support
- Closures in tags
- Asynchronous programming using Future
- Enhanced Object-Oriented Programming with the following:
- Optional semi-colons in a cfscript code
- Negative index support for strings
- Chaining of member functions
Command Line Interface and REPL
ColdFusion (2018 release) introduces Read-Eval-Print-Loop (REPL). REPL, a shell, is an interactive programming environment that takes single user inputs, evaluates them, and returns the result to the user.
For more information, see REPL.
REST Playground
Try out your ColdFusion REST services in the new REST Playground. Use the REST Playground to test, develop, and document web services.
For more information, see REST enhancements in ColdFusion (2018 release).
New caching engines
Boost performance through caching with the newly added engines:
- Memcached
- JCS
- Redis
- Custom cache plugin
For more information, see Caching enhancements.
Changes in ColdFusion Builder
ColdFusion Builder (2018 release) includes the following:
- Access codes from remote systems
- Import code profiler data
- Introduction of Cordova
- Eclispse upgrade to Oxygen
For more information, see What's new in ColdFusion Builder.
Other changes
Optional semi-colons
In this release, we have added support for making semicolons optional in cfscript. For example, the snippet below does not use any semicolon at the end of a statement.
<cfscript> animals = ['cat','dog','fish','bison'] lastAnimal=animals.last() writeOutput("The last element of the array is: " & lastAnimal) </cfscript>
A semicolon is not optional in a FOR loop. However, a semicolon is optional in a while loop.
<cfscript> for(i=1;i<9;i++){ for(j=1;j<=i;j++) writeoutput("*") writeoutput("<br/>") } </cfscript>
A semicolon is optional in generic syntax for ColdFusion tags. For example,
<cfscript> cfhttp(url="http://localhost:8500", timeout="60") </cfscript>
A semicolon is also optional in script-based components. For example,
component{ function myfunc(){ writeoutput("Optional Semi Colon Example") } }
In closures in tags,
A semi-colon is also optional while defining the body of closure functions in tags. For example,
<cfset closureFunc1=function(){ return true }>
Negative index support for strings
In the 2018 release of ColdFusion, there is support for negative index for a string’s left and right functions.
<cfscript> myString='Welcome to ColdFusion' writeoutput( myString.right( -1 ) & "<br>") writeoutput( myString.left( -1 ) & "<br>") writeoutput( myString.right( -8 ) & "<br>") writeoutput( myString.left( -8 ) & "<br>") </cfscript>
Output
elcome to ColdFusion
Welcome to ColdFusio
to ColdFusion
Welcome to Co
Chaining of member functions
You can chain member functions together to produce a desired output.
<cfscript> // Example 1 myarray=ArrayNew(1); new_arr= myarray.clear().Resize(10).set(1,10,"blah"); writedump(new_arr); </cfscript>
<cfscript> // Example 2 ordered_struct=["key1":"val1","key2":"val2"] unordered_struct={"key3":"val3","key4":"val4"} new_struct=unordered_struct.append(ordered_struct).update("key4","updated val4").insert("key5","inserted val5"); writedump(new_struct); writedump(unordered_struct); </cfscript>
Apart from adding these functions, the following member functions return appropriate array or struct values, as required when chaining the functions.
- Array
- arrayObj.clear()
- arrayObj.deleteAt()
- arrayObj.delete()
- arrayObj.deleteNoCase()
- arrayObj.insertAt()
- arrayObj.prepend()
- arrayObj.resize()
- arrayObj.set()
- arrayObj.sort()
- arrayObj.swap()
- Struct
- structObj.delete()
- structObj.insert()
- structObj.update()
- Async Member Functions
- then(UDFMethod method)
- then(UDFMethod method, long timeout)
- error(UDFMethod method)
- error(UDFMethod method, long timeout)
- get()
- get(long timeout)
- cancel()
- isCancelled()
- isDone()
New operator
In this release, there is support for new operator/syntax for com, component, CORBA, Java,. Net, webservice. For examples,
- obj1 = new java("java.lang.String")
- m = new component("employee ")
For examples,
Employee.cfc
component { public numeric function getPaid() { var salary=40*20; return salary; } }
Manager.cfc
component extends="employee"{ public numeric function getPaid(){ var salary=1.5*Super.getPaid(); return salary; } }
President.cfc
component extends="manager"{ public numeric function getpaid(){ var salary=1.5*Super.getPaid(); return salary; } }
Payday.cfm
<cfscript> // change the paths as required empObj=new component("path/to/employee.cfc"); manObj=new component("path/to/manager.cfc"); presObj=new component("path/to/president.cfc"); writeOutput("Employee earns: " & empObj.getPaid() & "<br/>"); writeOutput("Manager earns: " & manObj.getPaid() & "<br/>"); writeOutput("President earns: " & presObj.getPaid() & "<br/>"); </cfscript>
Named parameters in functions
Named parameters enable you to specify an argument for a parameter by associating the argument with the parameter's name rather than with the parameter's position in the parameter list. You can use named parameters in functions and constructors.
In earlier versions of ColdFusion, named parameters were allowed in user-defined functions and in component constructors.
In ColdFusion (2018 release), you can use named parameters for built in functions.
In previous versions of ColdFusion, the order of parameters in a BIF was necessarily fixed, since it was the only way that ColdFusion could identify which value is intended to be used for which purpose. Now with named parameters, the position or order of parameters does not matter; the arguments are evaluated in the order in which they appear in the list.
For parameter names, refer this document.
<cfscript> myarray= [4,2,1,3] writeoutput(ArrayFind(array=myarray, value="4")) writeoutput(Arrayfind(callback=function(index,item){ if(index == item) return true else return false }, array=myarray)) </cfscript>
ArrayFind can either accept a value to find in an array or a callback that has the searching logic. You can use both value or callback with named parameters as shown in the snippet above.
String literals
In this release of ColdFusion, there is support for string literals. For example,
<cfscript> writeOutput("ABCDEFGHIJ".substring(1,7).substring(2,5).lCase().len()); </cfscript>
Hibernate upgrade
ColdFusion (2018 release) uses Hibernate 5.2. The following are the highlights:
- Hibernate 5 XML Parser now uses JAXP (Java API for XML Processing). As a result, the way of declaring the class name in hbmxml ORM mapping file has changed, for example, cfc:cfsuite.orm.settings.dialect.invalid_dialect.invalid_dialect to cfc.cfsuite.orm.settings.dialect.invalid_dialect.invalid_dialect.
- Hibernate 5 no longer supports seqhilo generator.
- Hibernate 5 no longer supports offset queryoptions as it was inefficient and most of the underlying databases have the support for offset. However, this functionality can be enabled by setting the flag hibernate.legacy_limit_handler to true in the hibernate configuration file.
- Hibernate 5 Schema Update/Export validates the case sensitivity in table names. If the table name defined in CFC and database are in different cases, it does not work. The previous version of Hibernate allowed tables names defined in CFC and database to be case-insensitive.
- You must update an entity inside a transaction.
Changes to wsconfig tool
In the wsconfig tool, there is a new option related to tuning of connectors.
- Heartbeat Interval in seconds: The time interval in seconds after which the connector load data is sent to ColdFusion.
New Admin APIs
verifyRedisCacheStorageConnection
Description: Verifies connection to the Redis cache storage.
Syntax:
void verifyRedisCacheStorageConnection (sessionStorageHost, numeric sessionStoragePort, sessionStoragePassword)
|
Req/Opt |
Default |
Description |
---|---|---|---|
sessionStorageHost |
Optional |
Any |
The hostname for Redis cache storage. |
sessionStoragePort |
Optional |
Numeric |
The port number for Redis cache storage. |
sessionStoragePassword |
Optional |
Any |
The password for the Redis cache storage. |
setServerCachingEngine
Description: Changes the caching engine at the server level.
Syntax:
void setServerCachingEngine (required engine)
Parameter |
Req/Opt |
Default |
Description |
---|---|---|---|
engine |
Required |
Any |
|
setJCSClusterDsnName
Description: Set the data source for JCS cluster.
Syntax:
void setJCSClusterDsnName (required dsn, required boolean createTables)
Parameter |
Req/Opt |
Default |
Description |
---|---|---|---|
dsn |
Required |
Any |
Name of the data source. |
createTables |
Required |
Any |
Whether to create a table. |
setCachingRedisServer
Description: Set the caching engine for Redis.
Syntax:
void setCachingRedisServer (required host, required port, required password, required boolean cluster)
Parameter |
Req/Opt |
Default |
Description |
---|---|---|---|
host |
Required |
any |
Host address of the server. |
port |
Required |
any |
Port number of the server. |
password |
Required |
any |
Password of the server. |
cluster |
Required |
Boolean |
Whether a cluster is enabled in Redis. |
getMemcachedServer
Description: Gets the details of the Memcached caching engine.
Syntax:
any getMemcachedServer ()
Bugs fixed in ColdFusion (2018 release)
To see the list of bugs fixed, see Bugs fixed.
Known issues in ColdFusion (2018 release)
To see the list of known issues, see Known issues.