What's new in Railo 3.1

April 1, 2009 · By Michael Offner · 13 Comments

Since Railo 3.0 6 months have passed in which we have optimized Railo and introduced a bunch of new features into the Open Source version. Read more about what has changed.

Internal structure

We have changed a lot in the internal structure of Railo in order to improve the extensibility (extensions) and the performance.

Public Interface

The "public interface" (this is the way how you can interact with Railo in java) has been improved a lot. A detailed blog entry for this will follow. You can check out the public Railo interface here http://dev.railo.ch/javadoc/.

Ternary operator

Railo now supports the ternary operator which will make using inline conditions much easier. Check out the following example: <cfoutput>it is #isvalid?'fine':'bad'#</cfoutput> The pattern is: {condition}?{true-expression}:{false-expression} Check out http://en.wikipedia.org/wiki/%3F:#CFML_.28Railo_only.29 as well

Timezone defintions

In past you were "only" able to define the timezone of your web context in the Railo Administrator. Now you are able to do this inside your code for only a single request or a single function call as well. A detailed blog entry for this feature will follow.
<cfdump var="#getTimeZone()#:#now()#">
<cfset setTimeZone('GMT')>
<cfdump var="#getTimeZone()#:#now()#">
<cfset setTimeZone('PST')>
<cfdump var="#getTimeZone()#:#now()#">

You can compare this with the functions setLocle and getLocale. In this way you are changing the environment timezone for this request and like with locales you can also define the timezone as an argument for different function calls. <cfdump var="#lsTimeFormat(now(),'full','english (us)','Egypt')#">
The following functions do now support the timezone as an argument:
  • createDate
  • createDateTime
  • createTime
  • dateFormat
  • day
  • dayOfWeek
  • dayOfYear
  • daysInMonth
  • daysInYear
  • firstDayOfMonth
  • hour
  • lsDateFormat
  • lsIsDate
  • lsTimeFormat
  • milliSecond
  • minute
  • month
  • parseDateTime
  • quarter
  • second
  • setTimezone
  • timeFormat
  • week
  • year

Fusion debug

Railo now has an interface to interact with Intergral's FusionDebug as well. A detailed blog entry for this will follow shortly as well.

BlazeDS (AMF3) Support

Railo now has support for BlazeDS (AMF3) build in, detailed blog entry for this will follow. Check out Roli's blog on this as well.

CFC based customtags

The good old custom tags now come to the cfc age. You are now able to build customtags with the help of components instead of cfml templates. This makes customtags much more comprehensible. A detailed blog entry about this will follow.

sizeOf()

Railo now has a new function called "sizeOf". This function returns the size of the given object in bytes. You can use it for almost any type of object. <cfset a.b=array(1,2,3,4,5,6)>
<cfdump var="#sizeOf(a)#">
<cfset a.c=array(1,2,3,4,5,6)>
<cfdump var="#sizeOf(a)#">

Self controlled lib/classes

Railo now has a lib and a class folder for every single web context as well as for the global server context. This folders are managed by Railo, this allows you to add, remove and update jar/class files on the fly. A detailed blog entry for this will follow.

cfdump format

You are now able to define how your dump output should look like. Just see the following example: <cfset a.b=array(1,2,3,4,5,6)>
<cfdump var="#a#" format="html">
<cfdump var="#a#" format="classic">
<cfdump var="#a#" format="text">
<cfdump var="#a#" format="simple">
A Railo Administrator page that allows you to define the default debugging format will follow shortly as well.

Optional semicolons

The semicolons you use inside cfscript are no longer required. You can now also write commands per line only. <cfscript>
x=1
y=2
</cfscript>

Extensions

Railo now has a build in Extension Manager that allows you to install/update and uninstall extensions of any kind. Railo extensions as well as CFML applications. See Gert's blog entry for this.
More to come...

Tags: CFML

13 responses so far ↓

  • 1 Adam Reid // Apr 1, 2009 at 1:14 PM

    Does the ternary operator support output of an expression as well as a string?
  • 2 Gary Fenton // Apr 1, 2009 at 2:48 PM

    Congratulations of the launch of 3.1. Can't wait for your attractive new websites to be finished. :-)

    The ternary operator looks super useful, just like how it works in javascript.

    I'm in two minds about not requiring semicolons. It's very forgiving of Railo but it won't be enforcing best practice.
  • 3 Michael Offner // Apr 1, 2009 at 4:29 PM

    @Adam
    in the example above it outputs a string, you can this use with any type you want
    some more examples:
    &lt;cfset date=DateFormat(now())&gt;
    &lt;cfoutput&gt;
    #date EQ DateFormat(now())?'today':date#
    &lt;/cfoutput&gt;

    &lt;cfset fine=true&gt;
    &lt;cfset sct.a=fine?true:0&gt;
    &lt;cfset sct.b=fine?'susi':now()&gt;
    &lt;cfset sct.c=fine?array(1,2,3):struct(a:1,b:2,c:3)&gt;
    &lt;cfdump var=&quot;#sct#&quot;&gt;

    @Gary
    i'm with you, im not a big fan of the optional seicolon, pherhaps we will make a flag to the admin to disable/enable it
  • 4 Oscar Arevalo // Apr 1, 2009 at 4:33 PM

    I agree with the last post about the semicolons; I'm not sure if its a good idea UNLESS you guys know that this is the route that all CFML engines will follow. It is one thing to have a few functions/features to differentiate one engine from the other, but the true power of having a &quot;CFML&quot; standard is the portability of the bulk of the code between engines; and it doesn't seem that this kind of &quot;forgiveness&quot; helps achieves that goal.
  • 5 Simon WJ // Apr 1, 2009 at 5:14 PM

    Congratulations on the 3.1 release
  • 6 Sean Corfield // Apr 1, 2009 at 8:54 PM

    Give that semicolons are optional in JavaScript, ActionScript and Groovy (three languages I use a lot), I'm very glad to see semicolons be optional in Railo 3.1!

    Semicolons are also optional in Ruby and - in both Ruby and Groovy - it is considered &quot;best practice&quot; to omit them unless they are specifically needed to disambiguate some construct!

    And, yes, 3.1 is an awesome release - it runs cfSpec now! Another new feature: empty prefix works on &lt;cfimport&gt;!
  • 7 Matthew Williams // Apr 2, 2009 at 4:06 AM

    Is it just me, or is resin missing from all of the beta installs? I grabbed the latest stable install, and copied all of the beta files over top of the stable version.... anyone see this being an issue? This would be for the linux/Unix versions (and all OS as well, I think).
  • 8 Timothy Farrar // Apr 2, 2009 at 3:00 PM

    I'd like to hear more about the custom tag enhancements...
    Looks like a great release!
    Good work guys!
  • 9 Michael Offner // Apr 3, 2009 at 1:23 PM

    @Matthew

    no you are right, it was a issue in the deployer, we have fixed that

    tnx Michael
  • 10 Ryan LeTulle // Apr 7, 2009 at 2:27 PM

    What's the preferred method for updating an existing Railo install on Linux?

    Right now I've got a developer version installed and I can't seem to find a community key.

    Is my version now obsolete since Railo went open source? If so, is there a way to update to the latest without affecting the present configuration?
  • 11 Sana // Apr 15, 2009 at 4:03 PM

    @Gert, @Michael

    Would you please provide some info of this new feature &quot;Self controlled lib/classes&quot;, I am doing some experiments and so this can be helpful to me to avoid loading classes manually.
  • 12 Gert Franz // Apr 16, 2009 at 9:27 AM

    @Ryan: You can replace all JAR files from the corresponding download from the www.getrailo.org site and restart the server.

    @sana: The CFAdmin tag allows you to load libraries locally for your own web context at runtime. In addition any jar file located in the local conext under for example WEB-INF/railo/lib get's considered, but only for the current web context.
    If you want to have a jar available globally for all web contexts, just place it into the server context inside the lib folder there. This directory is normally found here:
    {railo-install-dir}/lib/railo-server/context/lib/

    Gert

    BTW: Sooo funny. Captcha just tells me to enter the letters rtfm :-)
  • 13 Ryan LeTulle // Apr 16, 2009 at 4:46 PM

    Thanks Gert. You ended up helping me get a key from the classic site. It's running great now so I won't update until a little later on. ;)

Leave a Comment

Leave this field empty: