My workshop….

Extensionless Browsing with IIS7

If we need to extension less browsing in ColdFusion with  IIS7, its possible if  URL Rewrite engine is installed. We can use the following code to browse the page without extension (without ‘.cfm’).  For Implementing this add the below piece of code to the web.config file.

<rule name=”CfmRemoved”>
<match url=”.*” />
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true”  />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
<add input=”{URL}” pattern=”(.*)\.(.*)” negate=”true” />
<action type=”Rewrite” url=”{R:0}.cfm” />


February 1, 2012 Posted by | Coldfusion | , | Leave a comment

Difference between Notify and Publish

With in an event-handler we can notify the listeners two ways (<Notify> or <Publish>). From Mach-II 1.6 allows notifying multiple listeners with a single <publish> command.

  • <Notify>

By using this, notifies a single method in a listener

E.g: <notify listener=”ListenerName” method=”MethodName”                                                  resultArg=”ResultSet” />

  • <Publish>

By using the publish command we can notify multiple listeners as follows.

E.g:  <publish message=”SomeMessage”/>

The ‘SomeMessage’ message registered in the <message-subscribers>.


<message name=”SomeMessage” multithreaded=”true” waitForThreads=”true” timeout=”30″>

<subscribe listener=”ListenerName1″ method=”MethodName1″ resultArg=”ResultSet1″/>

<subscribe listener=” ListenerName2″ method=”MethodName2″ resultArg=”ResultSet2″/>



November 7, 2011 Posted by | Machii | , , , | Leave a comment

Implementing CFX tags

Below shows an example for creating a cfx tag .

  1. First we have to create a  java file . For example Helloworld.java is the file contains the following code.import com.allaire.cfx.* ;
    public class HelloWorld implements CustomTag
    public void processRequest( Request request, Response response )
    throws Exception
    // Passed attribute (Name)
    if ( !request.attributeExists(“NAME”) )
    throw new Exception(“The NAME attribute is required!”);
    // display the content in the web page.response.write(“<P>Hello ‘ + request.getAttribute(“NAME”)+ “Welcome to cfx begining.</P>” );}
  2. Create the class file.
    The java file uses the package ‘com.allaire.cfx’> so adjust the path path as shown below.
    javac -classpath C:\ColdFusion8\wwwroot\WEB-INF\lib\cfx.jar HelloWorld.java
  3. Register the class in coldfusion administrator.
    Copy the class file to the folder C:\ColdFusion8\wwwroot\WEB-INF\classes\. Add the cfx tag name(CFX_HelloWorld) and class name(HelloWorld) in ‘Extensions’In the coldfusion page call the tag as ‘<CFX_HelloWorld AGE=”SomeName”>’ , you will get the output asHello SomeName Welcome to cfx begining.

November 3, 2011 Posted by | Coldfusion | , , | Leave a comment

Where the run time temporary file created in coldfusion?

In ‘coldfusion8 ‘ server the run time files created in the ‘wwwroot-tmp’ folder . Full path below.


August 4, 2011 Posted by | Coldfusion | | Leave a comment

Cfajaxproxy example.

This is a example for cfajaxproxy. In this here a text fields value checked with the sever side.

Html code below.

<cfajaxproxy cfc=”ajaxcfc” jsclassname=”validateAjax”>
<form action=”” method=”post”>
verify :<br>
<input type=”text” name=”txtField” id=”txtField” value=””>
<input type=”button” value=”verify” onclick=”return validateText();”>
<div id=”responseWrite”></div>
<script type=”text/javascript”>
function validateText(){
if (text.length){
ajaxObj = new validateAjax();

alert(‘Please enter text field value’);

please create a cfc named ‘ajaxcfc’ with the contents below.

<cfcomponent displayname=”ajaxcfc” output=”false”>

<cffunction name=”validateText” access=”remote” returntype=”boolean” hint=”function for check the input text field value with hard coded value”>
<cfargument name=”InputText” type=”any” required=”true”>

<cfif Trim(InputText) EQ “verify”>
<cfreturn 1>
<cfreturn 0>



July 15, 2011 Posted by | Coldfusion | , | Leave a comment

Multiple sites with the same DSN pointing different database

  • create a new folder ‘newtest’for the project at the same level of ‘\wwwroot’ folder.
  • Copy files for the website to this folder.
  • Copy the file /contexts/railo.xml into for example /contexts/mycontext.xml.
  • Change the content of the file as follows (Let’s assume that you will create a new host (context) with the name “mycontext”):

<?xml version=”1.0″  encoding=”ISO-8859-1″?>

<!DOCTYPE Configure PUBLIC “-//Mort Bay Consulting//DTD Configure//EN” “http://jetty.mortbay.org/configure.dtd”&gt;

<– <==================================================================

===================================================================== –>

<Configure class=”org.mortbay.jetty.webapp.WebAppContext”>

  <Set name=”contextPath”>/</Set>

<– <The directory is located ander the root of the installation. You can enter an absolute path as well –>

<Set name=”resourceBase”><SystemProperty name=”jetty.home” default=”.”/>/newtest/</Set>  <– <Jetty reacts on the following files –>

  <Set name=”welcomeFiles”>

    <Array type=”String”>







<– <- – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –>

  <– <Optional context configuration                                  –>

  <– <- – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

  <Set name=”extractWAR”>false</Set>

  <Set name=”copyWebDir”>false</Set>  –>

  <Set name=”defaultsDescriptor”><SystemProperty name=”jetty.home” default=”.”/>/etc/webdefault.xml</Set>

  <– <virtual hosts  –>

  <Set name=”virtualHosts”>

    <Array type=”String”>





  • Restart server
  • Add a new entry into your local host-file with the IP address and call it newtest
  • Call http://newtest/index.cfm
  • You can see the index page of your project.
  • Now new entry for the ‘newtest’ context will be shown in the Server administrator under web contexts.
  • In the webroot of the site /newtest you can see a folder named ‘WEB-INF’which is created by Raio, when we start the server. This folder contains files that are needed for the application settings for this context.
  • While logging as server administrator we can select the web contexts (administrators) for each context in which we can change the settings.
  • If no configurations are made in the web administrator of the contexts, the server administration configurations will be taken by default.
  • After adding the datasource, restart railo application server and access the site you can see that applications are running with their own database.

July 15, 2011 Posted by | Railo | , | 1 Comment

What is Railo?

Railo is an Open Source ColdFusion Markup Language (CFML) server and the fastest CFML engine available.

Railo translates and executes websites based on ColdFusion Markup Language (CFML). The compiler translates CFML code into Java classes which can be executed on a Java server. Railo also has a runtime engine, which contains all needed libraries for translated code. Railo automatically detects when to translate a CFM file, or when to use the runtime engine.

July 14, 2011 Posted by | Railo | | Leave a comment