Railo 3.0 released - Features part 2

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 !==).

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
nooree's Gravatar Hi~
<cfdocument format="pdf"> 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...
# Posted By nooree | 12.04.09 17:46
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner