Cflayout redraw problem

Written on 20 March 2015, 10:47am

Tagged with: , ,

Quick note about a problem with the cflayout tag – one of the Adobe’s attempts to play with the front-end. In my opinion – one of the places where ColdFusion no longer makes sense and should be replaced with a more robust alternative, like jQuery UI.

The problem: When using cflayout and cflayoutarea, if the content inside the cflayoutarea is dynamically redrawn, then the height of the layout area does not change. More details on the Adobe forum:

The solution:
Use the following styles:

<cflayout style="">
<cflayoutarea style="overflow-y:scroll; height: 450px;">

The drawback of this approach is that you need to hardcode the height of the layout area and accept the vertical scroll, but in some case this is exactly what you need.
The path to the solution was found on StackOverflow, as usual 🙂

Apache + Tomcat + ColdFusion + Java

Written on 20 March 2015, 09:24am

Tagged with: , , , ,

Below is a simple ColdFusion application architecture using Apache as web server and Tomcat as JEE application server.

1. Request workflow

Apache: In the Apache configuration file we have a virtual host <VirtualHost host1:80> with DocumentRoot /var/www/theColdFusionApp
Apache receives the request – example:
Hosts file: In /etc/hosts the host host1 is associated with the IP: host1
AJP module: If there is a non-CF request, Apache serves the request itself (ex. html, css, js, image). If there is a CFM request, the AJP module forwards it to Tomcat: ProxyPassMatch ^/(.*\.(cf[cm]|cfml))$ ajp://host1:8080/$1 (Apache config file)
Tomcat has an AJP connector on that port: <Connector port="8080" protocol="AJP/1.3"/>
and an engine to process the requests:

<Engine name="Catalina" defaultHost="host1">
 <Host name="host1"  appBase="webapps">
    <Context path="" docBase="/var/www/theColdFusionApp/"/>

Both entries above are in the Tomcat server.xml config file.
Application folders: In /var/www/theColdFusionApp we have both the CF files (WEB-INF and CFIDE folders) and the actual application folders. More details below.

2. Folder structure and configuration files


CFHTTP calling HTTPS urls

Written on 6 February 2015, 02:46pm

Tagged with: , ,

To use HTTPS with the cfhttp tag, you might need to manually import the certificate for each web server into the keystore for the JRE that ColdFusion uses.

Here is how to do that:
1. Load the HTTPS url in your browser and export the certificate as a .cer file (see link above for more details)

2. Copy the .cer file on the CF server

3. Locate the path of ‘Java Home’ in CF Admin. It should be something like /usr/java/jre1.7.0_51, usually with a symlink to /usr/java/default.
The keystore location should be {Java Home}/lib/security/cacerts and it’s password protected.

4. Import the .cer file into the keystore:

#/usr/java/default/bin/keytool -import -keystore 
/usr/java/default/lib/security/cacerts -alias thomas 
-file thomas.cer -storepass changeit

5. Check that the certificate was installed:

#/usr/java/default/bin/keytool -list -keystore 
/usr/java/default/lib/security/cacerts -storepass changeit -alias thomas 
# thomas, Feb 6, 2015, trustedCertEntry, Certificate fingerprint (SHA1): XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX

6. Restart ColdFusion server

See also this and that.