Contents |
Thanks to the efforts of Andrea Campologni (URL), Railo 3.2 features a massive set of functions and tags that allow you to add AJAX functionality to your applications with ease.
The AjaxOnLoad function allows you to programatically call a JavaScript function from Railo once the page has finished rendering.
If you would like to know more about this function checkout the AjaxOnLoad documentation.
The cfajaximport tag allows to import the javascript resources to be used into pages that use the Ajax Railo library.
<cfajaximport tag="CFWINDOW"/>
More on cfajaximport here.
Creates a JavaScript proxy for a ColdFusion component or create a proxy between a specific dom element and a cfc method a url or a javascript function.
<cfajaxproxy cfc="ajaxproxy.cfc.test" jsclassname="proxyObj" onSuccess="successCallback" onError="errorCallback"/> <script type="text/javascript"> var myProxy = new proxyObj(); myProxy.getData(); /* call a amethod passing parameters */ var myProxy = new proxyObj(); myProxy.getData(200,'text'); /* You can also pass parameters like a js literal object*/ var myProxy = new proxyObj(); var args = {arg:100,arg2:200}; myProxy.getData(args); </script>
More on cfajaxproxy here.
Creates an HTML div tag or other HTML container tag and lets you use asynchronous form submission or a bind expression to dynamically control the tag contents.
<cfdiv bind="url:file.cfm?name={myForm:name}&age={myForm:age}" onBindError="onError" bindonload="false" id="mydiv"/>
More on cfdiv here.
Embed a geo map into the web page. Available support only for google maps.
<cfmap name="myMap" centeraddress="345 Park Avenue, san jose, CA 95110-2704, USA" zoomlevel="10"/>
More on cfmap here. More on cfmapitem here.
Many ajax tags like cfdiv and cfajaxproxy make use of a particular binding syntax. Read more about the supported bind syntax.
Controlling your Railo Application has been enhanced with features added to the lifecycle of the Application.cfc component.
In most applications, when you used a datasource, you had to repeatedly specify it in your cfquery tag, sometimes even adding it to the application scope as:
<cfset application.dsn = "myDSN"> ... <cfquery name="getPosts" datasource="#application.dsn#"> Select ... </cfquery
In Railo 3.2, you can now define this application wide in your Application.cfc:
component {
this.name = "MyApplication";
this.datasource = "mdblog";
}
And in any query, you will use the default datasource without having to define it:
<cfquery name="getPosts"> SELECT * FROM mng_entry </cfquery> <cfoutput query="getPosts"> ... </cfoutput>
TODO
In Railo 3.2 we have added the onCFCRequest method to the Application.cfc. If you implement this method, any remote call to a CFC will be intercepted by this method. You can then implemnt your own processing of the Component (such as logging before it is called).
component {
this.name = "MyApplication";
this.datasource = "mdblog";
function onCFCRequest(String component,String method,Struct arguments){
//Do something
return true;
}
}
Railo now includes a number of components that are auto imported into your components and scripts. Each script has the "org.railo.cfml" pachage which gives you access to the following components in your scripts:
An example use would be to get a JSON string:
<cfscript> getInfo = new HTTP(url="http://localhost/sample.json"); Results = getInfo.send(); myStructure = DeSerializeJSON(Results.getPrefix().filecontent); </cfscript>
In Railo 3.2 we have added a number of innovative caching features that allow you to build scalable applications. We have enhanced the cache* functions to allow you to name the cache you want to add information to. See the related documentation for:
Buy default all these functions use the built-in RAM cache.
As part of Railo 3.2, we have added a number of server extensions that allow you to add different types of cache storage, rather than just relying on the built in RAM cache. This means that you can now use EHCache (lite), CouchDB and MongoDB as cache stores.
To install these, simply head to your server administrator (e.g. http://localhost/railo-context/admin/server.cfm ) click on the Extension/Applications section and you can install each of these caches.
With the addition of a number of cache extensions you can now use named caches to store your data. You can set a cache to be the default for Objects, Queries, Templates or Resources as well as storing data into a specific cache.
To store data to a specific named cache you can do:
<cfset cachePut("myItem", "test", createTimeSpan(0,0,10,0), createTimeSpan(0,0,10,0),"myCache")> <cfset cacheItem = cacheget("myItem", false, "myCache")> <cfdump eval=cacheItem>
Which will put the value "test" into the cache called "myCache".
In Railo 3.2, apart from being able to name each cache connection, you can assign each cache connection to be the storage for different types of caches. For example you could set up a connection to CouchDB for your objects, a connection to ram for your templates and use a distributed EHCache connection to store your queries.
This allows for scaling and clustering of applications that can then share the objects from the cache repositories.
In Railo 3.2 we have added a number of functions and CFScript language enhancements to help your productivity whilst coding in CFSCRIPT blocks.
Railo 3.2 has added the following Directory based functions:
Railo 3.2 has added and enhanced the following File based functions:
Railo 3.2 has added a number of other helpful functions