Railo 4.2 Final release

May 16, 2014 · By Michael Offner · 1 Comment

Some of you maybe already saw that we releases yesterday Railo 4.2 final (was about time!).
We did this as part of our "Railo 4.2/5.0" presentation at cf.objective as a soft release.
So ATM you can update in the Railo Admin, but there are no downloads available on our website yet,
but this will follow soon.
 
So what is Railo 4.2 about?
 
Language/General
Let me start with the general and language improvements.
 
Tags in Script

In addition to the already supported script tags in Railo, we add support for the syntax introduced with ACF11, so it's up to you to choose the syntax you like!

Example new Syntax:

cfloop (from=1, to=10, index="i") {
    echo(i);
}

Example existing and still supported syntax:

loop from=1 to=10 index="i" {
    echo(i);
}
 
Member function with Literals
Railo allows to use member functions on literal structs/arrays

Example:

[1,2,3,4].each( function() {
		dump(arguments); 
));

 
{susi:"Sorglos"}.each( function() { dump(arguments); 
));
 
Easy access for single characters in a string
https://issues.jboss.org/browse/RAILO-2780
Railo allows to use a string like a array.

Example:

str="Susi";
dump(str[2]);
 
String member functions
Railo is supporting all string member function including list member functions

Example:

str="Susi Sorglos";
dump(str.len());// equal to stringLen(str);
dump(str.listLast(' ')); // equal to listLast(str,' ');
We also added new member functions not supprted as regular functions 

Example:

str="Susi Sorglos";
dump(str.hasPrefix("Su")); // true
dump(str.hasSuffix("los")); // true
 
CFML based Filesystems
Railo is supporting a lot of virtual filesystems for a long time (ram,s3,ftp,http,zip ...), all this Filesystems are implemented in Java,
Railo now allows to write a virtual filesystem in CFML, so you can for example do a "dropbox" filesystem "simply" by implementing a specific component.
Detailed information about this will follow soon ...
 
Custom tag search in archives
Railo now can search Railo Archives recursive for custom tags
Extended or new Function/Tags
Railo 4.2 also comes with a basked filled with new and extended Tags and Functions
 
cachedwithin "request"
https://issues.jboss.org/browse/RAILO-2718
the attribute "cachedwithin" you have with the tag cffunction,cfquery,cfinclude allows to define "request" instead of a timespan. 
This way the result is cached for the current request.

Example:

<cfquery name="qry" cachedWithin="request">
   select lastname from Person where whatever=#whatever#
</query>
 
"cachedwithin" with tag cfinclude
we added the attribute "cachedwithin" to the tag cfinclude, so now you can cache includes the same way you can queries and functions!
 
cffunction "cachedwithin" improved
cffunction cachedwithin now also works with complex objects in the argument scope what was not possible before.
 
QueryExecute
We added the function QueryExecute, so now you have a additional way to do queries in script
here you have some examples for it, detailed documentation will follow ...
 
Iterator/Closure functions

Railo added a lot of new iterator/closure functions, i will not go into detail about the functionality of this functions, here just the list:
arrayEvery,arrayMap,arrayReduce,arraySome
structEvery, structMap, structReduce,structSome
listEvery,listMap,listReduce,listSome,ListEach, extend listFilter (https://issues.jboss.org/browse/RAILO-2994)
collectionEvery,collectionMap,collectionReduce,collectionSome
queryEvery,queryMap,queryReduce,querySome,queryEach 
Of course all this functions are available as member functions as well.
All functions (expect ...reduce) supporting the "parallel" and "maxThreads" arguments, that allows to execute parallel execution!
 
The response from the tag <cfhttp> now contains a new key "cookie" that contains the cookies passed back as a query, so you no longer have to parse the cookie header yourself.
 
cfdirectory/cffile createPath
extended the tags cfdirectory/cffile with the attribute "createPath" to have influence on whatis happening when a parent directory not exists
 
getCanonicalPath
added function getCanonicalPath that cleans a given path
 
QueryRowData
add function "queryRowData" to red a specific row from a query
 
structFind default
extended the function structFind with a optional default value
 
CreateObject pathes
3th argument of createObject("java",... can be a array instead of a string list
 
CallStackGet output type
added optional argument to the function callStackGet to get influence on the output type (text,hrtml,json) 
 
CfProcessingDirective preserveCase
add attribute "preservecase" to the tag <cfprocessingdirective> to control the behavior with dot notation keys in a template
 
ToBinary charset
add new optional argument "charset" to function "toBinary"
 
UCFirst improvement
https://issues.jboss.org/browse/RAILO-2812
it's useful to be able to lowecase an input string before calling UCFirst if ALL of the characters in the input string are UPPER case.
many times users input their names as: "SUSI SORGOLIS", in which case UCFirst does not do anything.
the proposed feature will correctly convert such an input string to "Susi Sorgolis", while preserving the case of the D in an input string like "Ronald McDonald"
 
GetTickCount improvement
https://issues.jboss.org/browse/RAILO-2391
Railo added support for shortcut for argument "unit"
 
QueryNew improvement
Extended QueryNew to allow populate the query directly
 
SerializeJson charset
Add argument charset to function SerializeJson
 
GetLocalHostIP improvement
improve function getLocalHostIP
 
DateTimeFormat improvement
https://issues.jboss.org/browse/RAILO-2673
Enhance function DateTimeFormat() to support ISO8601
 
DeserializeJson improvement
The function DeserializeJson keep order when deserialize a json struct
 
IsEmpty member function
Add member function isEmpty
 
 
Administrator 
We did also some improvements for the Administrator
 
Disable type checking
You can now disable type checking in the Railo Administrator
 
Mapping inspect "inherit"
Railo now allows you to define "inherit" for inspect setting of a mapping to inherit the behavior defined for the context.
 
Session/Client Storage definition
Railo now allows to define session/client storage in the Railo admin.
 
Application.cfc/CFApplication Tag
Railo 4.2 brings a lot of new possible settings for the Application.cfc, settings only possible in the Railo Administrator in previous versions.
This makes it easier for application developer to provide applications with specific environment needs to everybody.
For every setting in the Railo Admin that is also possible in the Application.cfc as well, you see a the following hint "<?/>" in the admin, that shows you how to use in the Application.cfc.
There is also a new page "Settings/Export" that shows you all settings possible in the Application.cfc that are possible in the Administrator.
All the following settings are also available with the tag <cfapplication>.  
 
Tag attribute default values
Railo allows you to define default values for attributes of all tags, including tags defined with extension.
Example:
this.tag.location.addtoken=false; // core tag library need no "cf" prefix definition

this.tag.cfdump.format="classic"; // but you can use "cf" prefix definition

 
cfapplication onMissingTemplate
you can define "onMissingTemplate" event listener with the tag <cfapplication> as well.
 
Locale/TimeZone
Railo added support for this.locale and this.timezone to the Application.cfc
Example:
this.locale="en_us";
this.timezone="PST"; 
 
Charset
Railo added support to set charsets in the Application.cfc
Example:
this.charset.web="UTF-8";
this.charset.resource="ISO8859-1"; 
 
Scope cascading
Allow to define the scope cascading behavior in the Application.cfc as follows:
 this.scopecascading="strict"; 
 
Request Timeout
Railo added the possibility to set the request timeout in the Application.cfc
(also this.timeout is supported as alias, for compatibility to ACF)
Exampe:
this.requestTimeout=createTimespan(0,0,0,20); 
 
GZip Compression
Railo added support for enable/disable gzip compression in Application.cfc
Example:
this.compress=true; 
 
 
Logging
Railo 4.2 has a completely rewritten logging framework which is now using log4j instead of a custom one previously. In addition, in the Railo admin you now can inspect all logs created by Railo and you can control where log files are written and how the output looks like. Railo 4.2 dramatically improves performance for the existing logging
 
Log "cfcatch"
Railo added a new attribute "exception" to the tag <cflog>, to make it possible to send exceptions (cfcatch) directly to a log.
Example:
<cftry>
	<cfthrow message="shit happens!!!">
	<cfcatch>
		<cflog application="true" type="error" exception="#cfcatch#">
	</cfcatch>
</cftry>
 
Administrator Frontend
There is now a page in the Railo Administrator to manage all the log files used
 
Attribute "log" improved
https://issues.jboss.org/browse/RAILO-2802
Since you now can define several individual loggers in the Railo Administrator, by giving them a name, you can use every of these loggers defined in the extended attribute "log". So you can not only use "scheduler" and "application" but you can define your custom logger in the Administrator and use it within the attribute. This is similar to the way you use a datasource name.
Example:
<cflog  log="myCustomLogger" message="#msg#">
 
 
Exceptions
Railo 4.2 improves the information you receive when an exception is raised. For example when you use a non-existing key in your code, Railo checks if there is a similar key available and informs about this key in the error message.
 
Lock increase Exception message
When a lock severity is getting increased inside an inner lock from read to exclusive, an exception thrown indicating that it was not possible to acquire the lock. In this particular case it is helpful to know why the error occurred. So the exception is informing you that your request already performed read lock and you now try to acquire an exclusive lock.
 
ORM Exceptions
Improved ORM Exceptions

1 CommentTags:

Railo Server and the Heartbleed vulnerability

April 17, 2014 · By Gert Franz · 2 Comments

Recently there has been a lot of buzz around one of the largest vulnerabilities in SSL, the Heartbeat exploit. There have been questions from the CFML community whether or how Railo Server is affected by this security threat. </ul>

[Read more →]

2 CommentsTags: Railo 4.0 · Railo 4.1 · Railo 4.2 · Security · Tips

(Last) Railo beta release (4.2.0.007)

April 09, 2014 · By Michael Offner · No Comments

On the "Development" update provider, you can find the latest Railo Beta release (4.2.0.007).

That release not only bring a lot of bug fixes, it also has some new features.


Iterator (Callback/Closure) Functions

In the last release we already added a couple of new iterator functions to Railo (arrayEach,arrayEvery,arrayMap,...), in this release we even extended that list with iterator functions for the "query" and  "string lists".
So we have new the following functions:
- QueryEach
- QueryEvery
- QueryFilter
- QueryMap
- QueryReduce
- QuerySome
- ListEach
- ListEvery
- ListFilter
- ListMap
- ListReduce
- ListSome
 
We had a vivid discussion about how the argument scope of the udf/closure called with the query functions should look like, again thx to everybody for that!
We decided not do add a new "QueryColumn" type to Railo and simply pass the current row as a struct to the closure/udf and the hole query with the 3th argument
(We will do a detailed blog post about this in the near future).
Of Course all the new query functions can also be used "member functions" (Example: myQuery.each(function(struct row,numeric rowNumber,query query){dump(row)});).
 
The "List" Functions work the same way as the array functions, with the different that you call them with a string list and not a array ;-)
ATM the list functions are not supported as "member functions" (more below).
 
In the last release we also added iterator functions that are not specific to a type, functions that can handle all kind of "collections", the same way <cfloop collection="..."> can.
problem was that the short names of this functions getting in conflict with existing  UDFs defined by existimg CFML applications, for example the function "map" that is also used as UDF in "wirebox".
So we decided to rename this functions to "collection...", so for example "Map" is now renamed to "collectionMap".
 
Of course all this new iterator functions (except ...reduce) are supporting parallel execution like the existing ones!
 
Member Functions
Railo is supporting member functions for some time now, for the types [array,date,struct,query]. In the current beta release ACF has adopted this feature and they added additional support for the type string,"list" and image as well.
In this release we added support for "string" as well (and the next release will support "image"), what we not have is support for "list" functions, because it was not sure at the time of the release how they will look like in ACF (current implementation is not ... very good and they plan to change it for the next beta release).
Until the final release all of this is not curved in stone, so please feel free to eat it alive!
 
we also added new member function for strings (startsWith,endsWith,isEmpty)
 
GetBuiltInFunction (experimental)
This new function is returning you any built in function as a object that can be used the same way as a closure/udf.
Example:
function test(function finder,string str,string sub){
   return finder(sub,str);
}
if(custom) func=function (string sub, strig str){...};
else if(caseSensitive) func=getBuiltinFunction("find");
else func =getBuiltinFunction("findNoCase");
res=test(func,str,sub);
 
Function Reference Documentation in Admin
in the function reference in the Railo Administrator you can now filter functions by keywords, so for example you choose "iterator" to list only the iterator functions.
 
Unary operators
Thx to Adam Cameron we have uncovered a bug with all unary operators that is fixed with this release.
 
This is the last beta release for 4.2, so please report any problem you have with it
Have fun
Micha 
 

List of Jira Tickets solved
Enhancement
[RAILO-2250] - add member function isEmpty() to String

Feature Request
[RAILO-2986] - add function QueryEach
[RAILO-2987] - add function QueryEvery
[RAILO-2992] - add function QueryMap
[RAILO-2994] - extend function ListFilter
[RAILO-2995] - add function ListMap
[RAILO-2996] - add function ListReduce
[RAILO-2997] - add function ListSome
[RAILO-2998] - add string member functions
[RAILO-3001] - add member methods startsWith() and endsWith() to string objects
 
Bugs
[RAILO-2961] - returning a complex object containing an array of complex objects with base components, does not return base components properties
[RAILO-2963] - Providing array of Structs for SOAP function argument as an array of Complex objects
[RAILO-2965] - properties of complex soap arguments are not dynamically typed
[RAILO-2976] - webservice Complex Objects as arguments don't get accessible data.
[RAILO-2978] - Soap webservices Complex type composed of an array of complex types, throws exception
[RAILO-3003] - webservice with component argument breaks
[RAILO-3005] - railo-inst.jar is deleted during upgrade process
[RAILO-3022] - unary operator creating a new variable in a other scope in some situation

No CommentsTags:

CFML Tip Of the week: Replacing the last element of a string

April 01, 2014 · By Gert Franz · 2 Comments

The functions replace() and replaceNoCase() offer the option to either replace one element or all elements. But what if I want to replace the last occurrence of a given text.

[Read more →]

2 CommentsTags: CFML · HowTo · Railo 4.2 · Tips

Dynamic function calls

March 25, 2014 · By Gert Franz · 2 Comments

Sometimes when for example you do a validation of a certain field, the check method you want to use in order to perform your check is unclear. There is a very neat way of approaching that with Railo.

[Read more →]

2 CommentsTags: Features · HowTo · Railo 4.0 · Railo 4.1 · Railo 4.2 · Tips

Tip of the week - improved tag output cfdump

March 11, 2014 · By Gert Franz · 2 Comments

This is a quick entry about the changes we made for the tag CFDump in the latest release of Railo 4.2.

[Read more →]

2 CommentsTags: New release · Performance · Railo 4.2 · Tips

Railo Beta release (4.2.0.002)

March 06, 2014 · By Michael Offner · No Comments

There is a new beta release from Railo 4.2 (4.2.0.002) on the dev update provider.

This release includes some bugfixes (see list below) but also 3 new features (2 adapted from ACF11 Beta).
 
QueryExecute
This function was ready for some time, but we waited for ACF11 Beta to release, so we could match the functionality (supported arguments)
This function now allows to execute a Query with a build in function as follows
// parameters as array
queryExecute("select firstname,lastname from Address where city=?",['new Bern']);
// or parameters as struct
queryExecute("select firstname,lastname from Address where city=:city",{city:'new Bern'});
// more complex data

queryExecute("select firstname,lastname from Address where city=:city",{city:{value:'new Bern',sqltype:'varchar'}});

 
BTW: you can use the same construct with the tag cfquery (including script tag)
<cfquery params="#['new Bern']#">
select firstname,lastname from Address where city=?
</cfquery>
 
ACF11 Script Tag Syntax 
In addition to the already supported tag syntax, we adapted the script tag syntax from ACF11, that looks as follows
cfloop(from:1,to:10,index:"i") {
   echo(i);
}
you can use all tags with that syntax, including  external tags with other prefix and custom tags
Of course the "old" syntax will still be supported
loop from=1 to=10 index="i" {
   echo(i);
}
But the old syntax will get a "deprecated" state with Railo 5.0 and perhaps get removed with Railo 6.0
 
Keep order of Json Struts
when you load a struct as part of a Json String, you had no chance until now, that you keep the order of elements in that struct, take this example
deserializeJson('{data:{a:1,b:2,c:3}}');
the resulting struct in data was in a wild order until now, so perhaps "b,c,a", but now Railo is keeping always the order and you always have "a,b,c" in that case!
 
Have fun with that release!
Micha
 
List of new Features
[RAILO-2202] - add BIF queryExecute()
[RAILO-2916] - add support for CF11 script tag syntax
[RAILO-2918] - keep order when deserialize a json struct
 
List of Bugfixes
[RAILO-502] - cfchart doesn&#39;t seem to use getContextRoot() for image URL
[RAILO-1563] - CFC SOAP web services doesn&#39;t allow you to use custom types as arguments
[RAILO-1987] - &quot;No matching Method&quot; exception with SOAP service - ACF compatibility
[RAILO-2016] - CFCHART URL attribute not working
[RAILO-2030] - CFChart - Unable to turn x-axis labels to display vertically
[RAILO-2275] - ORM - fieldtype=&quot;id,many-to-one&quot; works in CF10, but not Railo
[RAILO-2282] - cfchart the image map is only generated the first time the page renders
[RAILO-2615] - CFC SOAP web services don&#39;t convert key-value pairs to objects
[RAILO-2645] - J2EE-based session is not serializable
[RAILO-2803] - cfchart image paths are invalid when deploying railo with a context root
[RAILO-2886] - JDBC-Other has invalid classname as default
[RAILO-2888] - unnecessary synchronized setting
[RAILO-2894] - Flex AMF + cfthrow Issue
[RAILO-2895] - Clear Cache buttons from Admin server.cache fails
[RAILO-2901] - CallStackGet() reports wrong function names
[RAILO-2902] - super reference invalid when called from within closure
[RAILO-2919] - cachedwithin in cffunction caches infinite
[RAILO-2921] - isValid(&quot;integer&quot; ,&quot;1 5&quot;) returns true
[RAILO-2327] - enhance BIF GetLocalHostIP() to return all addresses
[RAILO-2634] - many cfchart horizontal types not working
[RAILO-2881] - parseDateTime() doesn&#39;t interpret just a YYYY ISO date correctly
[RAILO-2913] - Tags with several bodies can cause compilation issues
 

No CommentsTags:

Tip of the week: loops

March 03, 2014 · By Gert Franz · No Comments

When working with CFML there are little things that can make your life easier. Like for instance extending the functionality of loops. Loops are a very fundamental construct in CFML and therefore used very frequently. So adding extra functionality to such basic elements of a language can be of huge impact in ones daily programming work. At least for me, this definitely applies to loops.

[Read more →]

No CommentsTags: CFML · Features · Railo 4.0 · Railo 4.1 · Railo 4.2 · Syntax · Tips

Tip of the week: default tag attribute values

February 20, 2014 · By Gert Franz · 1 Comment

We have decided to revive the tip of the week series, since we have tons of new things that are in Railo 4.1 and upcomin in Railo 4.2, that we would like to publish a tip each week.
So here's the first tip of a feature that we have introduced in Railo 4.2 and which I consider to be a VERY major thing further on.

[Read more →]

1 CommentTags: Features · Railo 4.2 · Tips

Railo 4.2 Beta released

December 24, 2013 · By Gert Franz · 8 Comments

Railo 4.2 is as of now available as beta release and can be downloaded from our download page. There has been a lot that has made its way into this version and we are very proud of the work we have delivered. We are very sure that there are some features that again are changing the game in the CFML world

[Read more →]

8 CommentsTags: Features · New release · Performance · Railo 4.2