Railo 3.0 released - Features part 2

September 10, 2008 · By Gert Franz · 14 Comments

Since Railo 3.0 is a major release, many new things have made their way into the new version. Next to the things i mentioned yesterday, I would like to introduce you to a couple of other new compelling features.Instance synchronization
Nowadays in this performance driven IT world, sometimes it is quite important to build a cluster of several application servers in order to meet the requirements in uptime or response time. So you might build your cluster containing several Railo application servers which manage the load or act as the reliability system. These clusters might grow large over time and they are very often configured identically in order to serve the load that comes in for a certain application. Then it is necessary to keep the systems in a synchronous state, especially when it comes to the settings of your CFML engine.
You might distribute configuration files or distribute other XML files or similar and always restart the engine, but Railo 3.0 offers a much better way of doing this. You can connect two Railo instances (or even web contexts) and keep them synchronous. Very important to know is, that the servers do not need to be in the same network. If they can talk over port 80, it might even be that they are only available throughout the internet somehow.
More on this feature in a future blog entry and here.
Important to know is that all the synchronization information survives server crashes, since it makes use of the new Railo Task Manager.

Cluster scope
With Railo 3.0 we introduce a new scope called "cluster". It can be used to share data amongst two distant servers. This can be used in order to share information between two servers. It is quite easy to use this new scope. Just use it as any other scope:
server 1:
<cfset cluster.lastUpdated.server1 = CreateDateTime(2008, 09, 09, 12, 0, 0)>
<cfdump eval=cluster>
server 2:
<cfset cluster.lastUpdated.server2 = CreateDateTime(2008, 09, 09, 13, 34, 12)>
<cfdump eval=cluster>
on each servers the dump would look like this:
cluster
[-]Scope
SERVER2
Date Time {ts '2008-09-09 13:34:12'}
SERVER1
Date Time {ts '2008-09-09 12:00:00'}


The cluster scope also makes use of the Railo Task Manager and therefore survives server crashes as well. Read more about the cluster scope and how to define it either on our website or in this >blog entry.

New & improved tags and functions
Here's a list of all new or improved tags and functions we introduced in Railo 3.0: Functions:
  • imageDrawImage (draws an image over an image)
  • isVideoFile
  • isZipFile
  • arrayContains, arrayContainsNoCase
  • dayOfWeekShortAsString, monthShortAsString
  • dump (supports all CF8 attributes as arguments)
  • trueFalseFormat
  • GetFileInfo - support for attributes: isArchive, isSystem, scheme, isCaseSensitive, isAttributesSupported, isModeSupported
  • FileExists - support of file objects created by fileOpen
  • getCurrentContext
  • getMetaData

I especially would like to mention the two last functions. The function getCurrenctContext returns an array containing the call stack. So if you would do a <cfdump eval=getCurrentContext()> you might get something like this:
getCurrentContext()
Array
1
Struct
line
number 1
template
string /Users/johndoe/web/webroot/tmp.cfm
2
Struct
line
number 2
template
string /Users/johndoe/web/webroot/getCurrentContext.cfm

The second function accepts a new boolean parameter which tells Railo to return an array of all scopes (scope precedence) that contain a variable with the passed name. So the name needs to be a string: <cfset myTest()>
<cffunction name="myTest" output="Yes">
<cfset variables.myVar = "test">
<cfset url.myVar = "urlTest">
<cfset form.myVar = "formTest">
<cfset cookie.myVar = "cookieTest">
<cfset client.myVar = "clientTest">
<cfset var myVar = "localTest">
<cfdump var="#getMetaData("myVar", true)#">
</cffunction>

This will output the following:
Struct
local
string localTest
variables
string test
url
string urlTest
form
string formTest
cookie
string cookieTest
client
string clientTest

Tags:
  • CFVIDEO, CFVIDEOPLAYER, CFVIDEOPLAYERPARAM - will be part of the next blog entry
  • cfapplication (attribute mappings, customtags) - more info here
  • cfdbInfo (type users)
  • cfdocument (attribute htmlbookmark) - more info here
  • cffunction (returnformat="serialize")
  • cfhttp (addtoken = yes)
  • cfpdf (attribute filter and many other improvements)
  • cfthread (attribute type, retryinterval) - more on that in part 4 of this blog

Improved syntax
In Railo 3.0 we introduced some new additional operators that might make your life a little easier. Next to the short notation introduced in CF8 and CF 8.0.1 we have the following improvements in Railo 3.0:
  • i != j is equal to i neq j
  • i == j is equal to i eq j
  • i === j means i and j are the same instance of a variable
  • i !== j means i and j are two different variable instances
  • i <= j is equal to i lte j
  • i <> j is equal to i neq j
  • s &= "string" is equal to s = s & "string"
Especially the tertiary operator === is interesting because with this comparison you can finally find out whether a variable points to the same instance as an other one (same goes for !==).

Tags: CFML · Features · New release · Railo 3.0 · Release

14 responses so far ↓

  • 1 Andy Matthews // Sep 10, 2008 at 6:51 PM

    I would LOVE to see a legit ternary operator like javascript has:

    Example:
    var isAndy = (user == 'andy') ? true : false;

    ColdFusion currently has the IIF function, but it sucks because you have to ALSO use the DE function to make it work.
  • 2 Gary Fenton // Sep 10, 2008 at 10:59 PM

    Exciting stuff! :-) Will there be some working online demos of videos converted with Railo?

    There's a big gap between the new free version and the $2999 version. Any plans for something under the $1000 mark? Perhaps to include the multimedia features?
  • 3 Streit Michael // Sep 11, 2008 at 1:19 AM

    we plan the ternary operator for one of the next patch releases
  • 4 Gert Franz // Sep 11, 2008 at 9:43 AM

    Gary,

    all the additional stuff included only in Railo enterprise will be available as extensions for Railo 3.1 Open Source. We know that at the moment that is a huge gap between the two versions, but we think that we should concentrate on doing the extension manager right and not maintain more versions till November this year.
    In the extension manager you can buy these features one a piece, a bundle of several, or all at once for a certain price. On thing we will post on our website is, that if you buy the enterprise version of Railo now, half of the price (1500US$) gets converted into support provided by Railo. So you can have us do something for you for 10 hours. We will put something on our website today.

    As for CFVIDEO: You can always use the Railo Develop Version to play around with CFVIDEO. The examples I will blog about in Part 3 can be replayed locally as well. All videos you see in our blog are converted by Railo and CFVIDEO.

    Hope this helps...
  • 5 Gary Fenton // Sep 11, 2008 at 3:40 PM

    Gert, the extension manager is a brilliant idea. Users can have any slice of the cake they want without having to buy all of it. Yum! :-)
  • 6 nooree // Sep 11, 2008 at 3:51 PM

    I tried some sample codes about &lt;cfvideo&gt; and
    &lt;cfvideoplayer&gt;.

    http://www.nooree.com/blog/29
    http://www.nooree.com/blog/42

    Is it well formed code? :)
    So, Railo OS Version, it releases when?
  • 7 Gert Franz // Sep 11, 2008 at 4:54 PM

    @nooree
    Honestly: I have no Idea :-). Since I am absolutely not familiar with Koreean, I can't follow your blog at al :-(. But it looks good and interesting.

    Railo OS will be released towards end of November this year
  • 8 Ronan // Sep 11, 2008 at 7:17 PM

    That's awesome.

    I would like to have:

    a += 1
    b += &quot;a&quot;
  • 9 Gert Franz // Sep 11, 2008 at 8:33 PM

    Ronan, that works:

    a += 1 works as you request but instead of
    a += &quot;a&quot; just use a &amp;= &quot;a&quot;...

    Gert
  • 10 Devon Burriss // Sep 15, 2008 at 3:48 PM

    Anybody run into any problems using cfdocument and cfpdf?
    I tried the following code (I don't think I changed it since)
    &lt;cfset thisPath=ExpandPath(&quot;*.*&quot;)&gt;
    &lt;cfset thisDirectory=GetDirectoryFromPath(thisPath)&gt;
    &lt;cfset variables.thefile = &quot;#thisDirectory##createUUID()#.pdf&quot;&gt;
    &lt;cfdocument name=&quot;report&quot; format=&quot;PDF&quot;&gt;
    &lt;html&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;div id=&quot;page_content&quot;&gt;

    &lt;!--- Render The View. This is set wherever you want to render the view in your Layout. ---&gt;

    &lt;h1&gt;test&lt;/h1&gt;
    &lt;cfoutput&gt;#thefile#&lt;/cfoutput&gt;
    &lt;/div&gt;

    &lt;/body&gt;
    &lt;/html&gt;
    &lt;/cfdocument&gt;

    &lt;cfpdf source=&quot;#report#&quot; action=&quot;write&quot; destination=&quot;#thefile#&quot;&gt;

    I get java.lang.NullPointerException.

    Worked fine on CF8...
  • 11 Devon Burriss // Sep 15, 2008 at 4:18 PM

    On further testing it appears that Railo 3.0 will throw an error if there are any html tags in between the cfdocument tags.
  • 12 Devon Burriss // Sep 16, 2008 at 12:37 AM

    So sorry for the posting. Not sure where else to do it.
    It appears that it is only html H tags that break it? odd...
  • 13 Streit Michael // Sep 16, 2008 at 1:27 AM

    Hi Devon

    we will take a close look at your exampe, railo shoud handle this situation.
    you can post any future issue on https://jira.jboss.org/jira/browse/RAILO

    tnx Michael
  • 14 nooree // Apr 12, 2009 at 5:46 PM

    Hi~
    &lt;cfdocument format=&quot;pdf&quot;&gt; tag is not working perfectly.
    When generate the PDF, the Korean(or Japanese, Chinese) will not be displayed.
    What do I do?

    Please help me...

Leave a Comment

Leave this field empty: