Lucee - new kid on the block

On 29th of Janurary in London there was a reason for these nice people to throw a small party -- the announcement of Lucee.

Lucee is a CFML engine Open Source project, forked off Railo. Reasons for spin-off are rather legal, new non-profit enitity will be steering Lucee development. Anyone could be involved in process, and with open source approach, new structure will create more traction for fresh CFML engine (and maybe, for CFML in general). 

Nothing new is added at this point, Lucee starts where Railo is standing now, and Lucee receive first version 4.5. Installation is simple - just replace jar files in [railo]/lib folder with those from official site. It took me 2 mins and no problems occured during update. Installer is to be developed, but Viviotech is in supporters, so maybe they will deliver. Major content platforms and number of hosters are supporting new platform, so stay tuned, more to come.

Official site | Forum | Wiki | Twitter

Java Minute Web 1: Servlets

Recently I entered Java web development world, which is level up in skill after ColdFusion development and a dig-down inside Java technology stack. Being lucky not touch Java EE internals for a decade, thanks to ColdFusion and Railo, I found Java web development to be unnesessary complex but very robust and honed technology (especially if compared to boiling goo of server side Javascript). 

For reference I picked 2 books: Java EE7 Essentials by Arun Gupta and Professional Java for Web Applications by Nicholas S. Williams

Basics of web-development are starting with Servlets, and here are some of my notes. I'm using IDEA Studio 13 and Tomcat 8 installed on Windows machine. Current J2SE JDK is 1.8 update 25.

First step is a setting up new Java EE project in IDEA:

Adding Tomcat as Run/Debug configuration:

package com.rodionbykov;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloWorldServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.getWriter().println("Hello, World!");


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns=""



REST API prepared on ColdFusion with FW/1 and DI/1 dressing

Cooking Developing REST API with ColdFusion or Railo is not a big deal now

But what if you don't want to create 'special' CFCs, want to reuse code from other projects and stay in line with rest of your FW/1 application ? Then you want to use FW/1 features to create REST API. I prepared small example which involves user login and returning user data via REST API.

The core of API code is FW/1 routes and CFC methods which are executed when route URL is called. To set up routes, Application.cfc is modified to have variables.framework.routes variable store mapings from REST routes to regular FW/1 application actions.

// Application.cfc
variables.framework = {
routes = [
{ "$GET/users/$" = "/users/list" },
{ "$GET/users/:id/$" = "/users/get/id/:id" },
{ "$POST/users/$" = "/users/create" },
{ "$DELETE/users/:id/$" = "/users/delete/id/:id" }
{ "$POST/users/login/$" = "/users/login" },

Note that HTTP method and route is mapped to FW/1 application route. Calling GET method on [siteroot]/users URL (route) is like having the framework to execute list() method in users.cfc controller via /index.cfm/users/list/ call. What is different from regular execution, is that controller method will use variables.fw.renderData method to return data. No view file will be searched for, unlike it happens in regular FW/1 method call.

To get advantages of DI/1 and bean factory we should have two files in our project  


and register bean factory in Application.cfc

// Application.cfc
function setupApplication(){
var bf = new org.corfield.ioc('model');

The argument for bean factory ('model' in our case) is the path where factory going to look for beans and services. Bean is CFC entity that is created every time we asking factory to get us one. Services are created only once (singletons). Here's folder structure:


User is a bean representing user of the system and Security is a singleton CFC instance which is in charge of user management (retrieves and modifies user details and user permissions.)

Now, the routes are in place, bean factory is setup, we need method to do actual work (in this case, login user)

// controllers/users.cfc
component accessors="true" {
property name="SecurityService";
function init(fw){
variables.fw = fw;
function login(rc){
var jsondata = DeserializeJSON(GetHttpRequestData().content);
var user = VARIABLES.SecurityService.login(jsondata.login, jsondata.password);
variables.fw.renderData("json", user);

First as we see here, component's accessors property set to true, to have ColdFusion add implicit getters/setters methods for component properties. The SecurityService property is declared, following naming convention - we have /model/services/Security.cfc, which became SecurityService (yes, DI/1 is clever enough to understand that singular "service" means plural "services".) So VARIABLES.SecuirtyService will receive singleton object of Security.cfc. Result of SecurityService.login() method is then passed to FW/1's renderData method which will output object in JSON-encoded format. Valid encoding are also XML and plain text. DeserializeJSON method is used to create ColdFusion objects out of JSON-encoded data that is being sent to API with POST method.

Raw request is looking like this:

POST http://localhost/users/login HTTP/1.1
Host: localhost:80
Content-Length: 33

Raw response generated by our code:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=utf-8
Content-Length: 72

In following article, I'll describe server setup for proper REST API functioning. For commentaries please check this post in CF User Group Ukraine Facebook group.

Fast start with Railo and Apache web server

After system reinstall, I had to quickly rebuild development environment with Railo and Apache (or nginx web server). Small cheat-sheet on configuring web servers with Railo.

0. No web server front

Railo on top of Tomcat has its own web server built-in, and it listens to port 8888 by default - if accessed with browser directly, Tomcat will answer without need of Apache HTTPD or other web server at all.

1. Classics: using ajp

Use Apache 2.4 binaries from Apache Lounge and install mod_jk.

# File:
# File: mod_jk.conf
LoadModule jk_module modules/
JkWorkersFile /etc/httpd/conf/
<IfModule jk_module>
JkMount /*.cfm ajp13
JkMount /*.cfc ajp13
JkMount /*.do ajp13
JkMount /*.jsp ajp13
JkMount /*.cfchart ajp13
JkMount /*.cfres ajp13
JkMount /*.cfm/* ajp13
JkMount /*.cfml/* ajp13
JkMountCopy all
JkLogFile C:\Apache\logs\mod_jk.log
# File: httpd.conf
Include mod_jk.conf


2. Forwarding to AJP port 

We can get rid of mod_jk, and use mod_rewrite for URL tweaking and sending CFML requests to Railo

# File: httpd.conf
ProxyPreserveHost On
ProxyPassReverse / ajp://localhost:8009/
RewriteEngine On
RewriteRule ^(.+\.cf[cm])$ ajp://localhost:8009$1 [P]


2.1 Forward to built-in web server

Instead of forwarding to AJP port, we can forward to built-in web server directly:

# File: httpd.conf
ProxyPassReverse / http://localhost:8888/


3. Using Railo with nginx front

If you feel comfortable with nginx for serving static files, here's config to forward CFML requests to Railo. Works perfectly.

# File: nginx.conf
server {
listen 8000;
server_name localhost;
 location / {
root c:/wwwroot;
index index.cfm index.html index.htm;
 # Main Railo proxy handler
location ~ \.(cfm|cfml|cfc|jsp|cfr)(.*)$ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;

Nexus S on Windows 8 issue

I've got a bit outdated Nexus S phone and I decided to try it as test device for some Phonegap development. I had it updated with CyanogenMod for Nexus S (crespo) to Android 4.4.2 in less than one hour. But when tried to run Phonegap app on it, seem like Windows 8 has problem identifying the device (Ubuntu doesn't FTW!). The driver I've found on Samsung website didn't help, phone was listed as unknown device in Device manager. However, generic Google USB Driver that comes with Android SDK does the trick. Use 'Update driver' for unknown device in Windows' Device manager and point it to

[Android SDK folder]\sdk\extras\google\usb_driver\

to help Windows locate driver.

Nexus S Windows 8

After this, plug in Nexus S to USB, turn on USB Debugging, accept computer's key permanently (it will be prompted on phone). Check device to be properly found by SDK by issuing command:

>adb devices
List of devices attached
3232DCDC6699E0E0E0 device

Now the Nexus S device is ready for application development.