A while ago I wrote an entry about why people should consider Railo. Well,
with the Release Candidate for version 2.0, there comes a lot more reasons
for using Railo.
And here are twenty of them:
1. Multi-webroot architecture
Railo has been built from the ground up to support multiple seperate web contexts within a single installation. It has a single server administrator for setting defaults and restrictions, and then you can create multiple independant web contexts that each have their own web administrator and settings, isolated from all the other web contexts on the server.
You can then properly enable or disable features (such as file access, java access, cfexecute, and so on) per web context as you like.
At first glace, this might appear to simply be 'just' a cool feature, but it is actually a very powerful concept. Resources are virtual file systems, allowing you to treat different things as simple storage areas, without needing to know how the underlying data is actually saved.
Railo 2 comes with support for: RAM; ZIP; FTP; SFTP; and more, plus there is a public API that allows you to easily add your own.
The best bit? Every single file/directory/template/mapping/etc tag and function within Railo can make use of resources. This means you can use cfdirectory/list against an FTP site, you can cffile/write into a ZIP archive, you can cfinclude a template from RAM, and so on. And you can do all of these to a mapping, meaning you don't need to know where the files are going to/from, and you can easily change what is happening without needing to rewrite the application. Once you start thinking about what you can use Resources for, you'll see they can help simplify a huge number of tasks.
3. Controllable Filename Case-Sensitivity
Another great feature of resources that deserves a number on its own is that you can control the case sensitivity of them - you can make Linux case-insensitive, or Windows case-sensitive. Very useful if you work in multi-OS environments.
4. Trusted Cache per mapping
In CFMX, you can turn Trusted Cache on or off, but only for the entire server, meaning you have to choose to sacrifice either speed or refreshability.
With Railo, you can enable or disable it for individual mappings. So turn it on for framework core files, and switch it off for dynamic/config files, and you get speed benefits without having to spend ages wondering why your changes are not getting picked up.
5. Configurable scope cascading
Scope cascading is a nice feature that allows you to be flexible when referring to variables.
Instead of worrying about whether something exists in Form or Url or Cookie scope, you can simply let the engine sort through and use the first one it finds. However, this flexibility comes at a price of performance and clarity, and so Railo allows you to restrict scope cascading to a smaller set of scopes in order to speed things up.
Oh, and if you want to make it strict but still not worry about looking in both Form & Url scopes, Railo can merge the two scopes into one.
6. Multiple mail servers
With Railo, you can specify multiple mail servers. If the first one is down, then it will try the next one, and so on.
7. Configurable Locale settings
Railo allows you to configure the timezone for which Now() returns the time - it can be distinct from the value of the server (which is available with the NowServer() function).
You can also seperately configure the default character sets for templates, website and resources.
8. Configurable Application.cfm/cfc handling
You can control whether Railo looks for just Application.cfc, just Application.cfm/onRequestEnd.cfm, both of these, or none of them.
You can also choose to override the default locations and force it to only look in the current folder, or only look in the webroot folder.
9. Restart Railo from the Administrator
Does exactly what it says on the tin. You don't need to telnet or remote desktop onto the server, you can simply click a button in the Admin and have Railo restart itself.
10. Configurable component This scope
In CFMX, components have a public This scope and an internal Variables scope (which can conflict with the global Variables scope). In Railo, you can merge these two scopes into the This scope, and you can choose whether This is private/package/public/remote.
11. Implicit getter and setter notation
I hate the whole
<cfset something = Object.getBob()/> and
<cfset Object.setBob(something)/> syntax — it's ugly, over-verbose and just annoys me. However, the concept of functions that run when variables are read and written is a useful one.
With Railo, you can simply use
<cfset something = Object.Bob/> and
<cfset Object.Bob = something/> and Railo can then look for the getBob() and setBob() functions in the component and implicitly execute them if they exist.
12. Component conversion functions
Very handy if you use components for storing data, if you create functions called _toString, _toDate, or _toNumeric inside a CFC, you can then do stuff like:
<cfset Person = CreateObject("component","person").init(id=1)/>
<cfset Salutation = "Dear #Person#"/>
<cfset Birthday = DateFormat(Person,'dd mmm yyyy')/>
And these magic functions will be used to convert the object to the appropriate type.
13. Url-based array creation
If you pass multiple values with the same name through the Url (or Form), you will get a comma-delimited list.
For example, "
index.cfm?name=Alice&name=Bob" will produce "
Alice,Bob" in Url.Name - this can be a handy trick, but what happens when you need commas in the values? Well, they still get treated as delimiters if you tried to use the list. With Railo, you can convert values directly to an array, simply with brackets: "
index.cfm?name=Cooper,Alice&name=Davies,Bob" will produce an array containing just the two names, commas intact.
14. Nested Struct/Array/Query creation
CF8 will bring support for implicit struct and arrays, however you are limited to a single dimension - you cannot create a struct inside a struct, etc.
With Railo, you can easily create Structs, Arrays AND Queries, and nest them all to your heart's content.
Railo 2 supports creation of PDFs using the cfdocument tag. In addition to this, you can combine multiple PDFs into a single document, and also convert text files and images into PDF documents.
This is similar to cfcatch, but it will always happen, if an error has been caught OR if everything worked fine. Very useful if you need to be sure that something is cleaned up in all cases.
No more do you need to do a Query of Query simply to re-sort a query object - just do
QuerySort( myQuery , 'column_name' ) and the query will be re-sorted.
Soundex is a phonetic algorithm for indexing names based on their pronunciation. The Railo function accepts a string and returns a code representing the pronunciation. This can then be compared with other soundex values - close pronunciations will have identical or similar values.
In Railo, the regular cfabort works exactly as CFMX. However, if you specify
<cfabort type="page"/> it will abort only the current page/template, and not the whole request. If you've ever had to wrap large chunks of script in cfif, you'll know how useful this can be.
20. Still fastest!
With ColdFusion 8, Adobe have made some great improvments over CFMX7 in the performance department, and pretty much caught up with Railo 1. However Railo 2 has also improved, and is reported to be between two and three times faster than Scorpio, maintaining it's crown as the fastest CFML engine available.
And that's the score... it was almost tempting to keep going to thirty, but if you're not already convinced then I'm not sure it'd help.
Railo is really good, so go give it a try!