RAILO SERVER 4.2

  • Railo 4.1 Beta! Check it out now!

    Railo 4.2 Beta! Check it out now!

    Check out the upcoming update. Feature packed and ready to go

    Download it now »

  • Railo newsletter

     

    You want the latest news? just subscribe to our newsletter.

    Subscribe »

  • Update Notification

    Check for Railo updates

    You want the latest server updates? just subscribe to our update notification service.

    Subscribe »

  • Vote for your favorite Railo enhancement

    Need something implemented?

    Railo a better productthanks to you

    Vote and suggest the next Railo features

    Learn More »

  • Super Support Options!

    Support Packages to suit your business

    Whether you are a big enterprise, or an individual developer, we are here to help and get your project on it's way.

    See which one suits you »

  • Get Up to Speed!

    Training Courses for all your team

    Getting up to speed on using Railo Server effectively is now even easier than ever with our on-site and remote training courses

    Attend a course now »

Railo Book
Finally out on the shelves is the Railo 3: Beginner's Guide book. Written by Mark Drew, with contribution by Gert Franz, Paul Klinkenberg and Jordan Michaels, this is an indispensable guide to getting up and running with Railo Server. You can get it now from Packt Publishing.
Buy it now!
Railo Community

We know it can be frustrating getting going, but with the documentation, help and support from the community you will get going in no time! Why not check out the mailing list? As well as community based support you can call on a professional team of consultants to get you going in a jiffy!

Community Resources
Railo Source Code

Want to check out the latest Railo Source? Railo Server is hosted at Github. This means you can clone the source, build the server and even implement new and exciting features. 

View the Source

Railo Blog

April 1, 2014
CFML Tip Of the week: Replacing the last element of a string
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.

Consider the following problem. We have the string:

this is the haystack where the needle is hidden. This is a very small needle, so I hope the needle will be found

and we want to replace the last occurrence of the word needle with object. So that the text looks like this:

this is the haystack where the needle is hidden. This is a very small needle, so I hope the object will be found

Obviously there is the usual programmed posibility to do something like this:

<cfscript>
   sNeedle = "needle";
   sReplace = "object";
   sHayStack = "this is the haystack where the needle is hidden. This is a very small needle, so I hope the needle will be found";
   iTmpPos = find(sNeedle, sHaystack, 1);
   iLastPos = iTmpPos;
   while (iTmpPos neq 0) {
      iLastPos = iTmpPos;
      iTmpPos = find(sNeedle, sHaystack, iLastPos+1);
   }
   replacedString = left(sHayStack, iLastPos - 1) & replace(mid(sHayStack, iLastPos), "needle", sReplace, "once");

   dump(replacedString);
</cfscript>


This code is first searching for the last occurrence of the search string. Then it concatenates the result and replaces the new string in the partial string which contains the last occurrence of the search string.

But there is a very neat other way of doing it. Have a look at this code:

<cfscript>
   replacedString = reverse(replace(reverse(sHayStack), reverse("needle"), reverse(sReplace), "once"));
   dump(replacedString);
</cfscript>


It just occurred to me when a colleague of mine asked me about replaceLast(). Obviously it will work correspondingly with replaceNoCase as well.
March 25, 2014
Dynamic function calls
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.

Let's assume you want to test an input field for it being required, the value being a date, numeric or email or whatever type of value. I lately approach this in the following manner:

Let's assume we have a cfc that is called check.cfc and that contains the methods:
  • required()
  • checkEmail()
  • checkNumeric()
  • checkRange()
  • checkSize()
<cfscript>
oCheck = new cmpn.check;
sType = "numeric"; // this contains the type of the check
stChecks = {required:["required"], email:["checkEmail", numeric:["checkNumeric","checkRange"], string:["checkSize"], date:["checkDate","checkRange"]};

aFunctions = stChecks[sType] ?: [];

loop array="#aFunctions" index="iFunction" item="sFunction" {
   sResult = oCheck[sFunction](myValue);
   if (!isEmpty(sResult)) {
      break;
   }
}
</cfscript>


where the functionname is declared at runtime in the array.
The code that makes the difference is this one:

oCheck[sFunction](myValue)

What here happens is, that you can call functions without knowing the corresponding functionname on compile time. In this case I loop through an array of function names. It might be not the exact example you're looking for, but it might help you further.
And even better. If the method is not found, and your cfc has implemented the method onMissingMethod it will be called instead. I find this approach very handy at runtime.
March 11, 2014
Tip of the week - improved tag output cfdump

First of all we greatly improved the performance of the tag output in comparison to Railo 4.1. The improvement is up to factor 30 depending on the size of the dump.
Next to the performance improvement you have now the opportunity to choose your own layout in terms of colors for the tag. Available here are:


  • railo
  • classic
  • pastel
  • modern
  • text


So the output for pastel queries for example looks like this:


Next to this feature, you have two new click options. If you are dumping a query, you have the ability to hide columns, by clicking on the header of the query. See this example:


now if I click on the header called request time, it will look like this:

If you want the columns to reappear, just click the [+] button and they will be displayed. Also a new feature is the display of the path through a structure when you click on a certain key. Consider this example:

<cfset application.stcache.stpages.stentries.stpage.height="60">
<cfset application.stcache.stpages.stentries.stpage.width="60">
<cfdump eval="application">


If you now click on the struct key called height:


you will see the complete struct path in order to retreive the key in question getting displayed. It is already marked for copying. This makes it easy to address certain keys in a large struct.


There will be more improvements going into the tag CFDUMP in one of the next releases, so ideas are welcome.