htm/html file parsing by ColdFusion 8

Ok, I know this isn't widely accepted as "ok" and not many people will ever do this, but having the ability to do this, is nice if you need it. And I needed it for a new project that is wrought with a boatload of .html files that I need to utilize and I do not have time to re-create things right now. Anyway, thanks to a couple sites (and oddly enough the final bit of information came from an Experts Exchange post) I have put all the pieces together to make this work with Coldfusion 8. Here is a link to the Adobe Technote on this process.

For the webserver side of it:

Windows 2003 (IIS 6.x)
In IIS manager, right-click the website and select properties. Select the Home Directory tab. Click Configuration. Select the .cfm extension in the list and click Edit. Copy the path in the Executable box to the clipboard.

Click Cancel. Click Add.

Paste the path in the Executable box. Type .html in the Extension box. Deselect the Check That File Exists option.

Click OK. Restart IIS.

Apache 2.2.x
Go to the configuration directory for Apache. Edit the httpd.conf file. Locate the "AddHandler jrun-handler" entry. Add the .html extension at the end of that line. For example: "AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf .html" Save the file. Restart Apache.

Sun One Web Server 6.1 (iPlanet)
Go to the configuration directory for Sun One Web Server. Edit the obj.conf file. Locate the following line and copy it to the clipboard: ObjectType fn=type-by-exp exp=*.cfm type="jrun-internal/ext"

Create a duplicate of the code block by pasting it below the original. In the duplicate code, modify the exp attribute as follows : ObjectType fn=type-by-exp exp=*.html type="jrun-internal/ext"

Save the file and Restart the server.

Then for the Coldfusion side of it... edit this file: C:\ColdFusion8\wwwroot\WEB-INF\web.xml

Modify and insert at the end of the other mappings (making sure to change the id="" sequential):

<servlet-mapping id="coldfusion_mapping_15">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_16">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_17">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.htm/*</url-pattern>
</servlet-mapping>
<servlet-mapping id="coldfusion_mapping_18">
<servlet-name>CfmServlet</servlet-name>
<url-pattern>*.html/*</url-pattern>
</servlet-mapping>

(*note - one visitor has noted that removing the id="" altogether worked for him, and that having numbers in there in fact, did not work)

Step 2: Open a command window (Start --> Run --> type "cmd")navigate to: C:\Coldfusion8\runtime\bin enter this line exactly:

.\wsconfig -server coldfusion -ws IIS -site 0 -coldfusion -map ".htm,.html" -v

Restart the webserver. (using iis reset from a command line prompt)

Restart Coldfusion. (from the services panel in administrative tools)

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Joe Zack's Gravatar Is there a benefit to doing this instead of renaming all the files with a .cfm extension?
# Posted By Joe Zack | 4/29/09 7:19 PM
tony's Gravatar sure. let's say you're uber secure and do not want hackers to know what type of backend system you have. if you were to obscure your .cfm files with .html extensions, you would prevent them from having that clue that you use coldfusion in your backend system. or lets say for instance you wanted to take over an older system that was written in simple html, and didnt feel like converting everything over to .cfm, you would definitely make life easier for yourself if you did this.

and this is the reason i did it this time.
# Posted By tony | 4/30/09 5:43 AM
Peter Bell's Gravatar Nice posting! It's something I've done for my clients for a while. Here was the write up I did . . .

http://www.pbell.com/index.cfm/2007/3/31/Processin...
# Posted By Peter Bell | 4/30/09 11:15 AM
tony's Gravatar hi peter! i actually saw yours and followed it each step of the way, however, i got stuck. and the final part that i needed was the command line code. once that was done it was cake and worked perfectly! might want to add that last little bit to your instructions and it will be SPOT ON!

thanks man.
# Posted By tony | 4/30/09 11:24 AM
Scott Berry's Gravatar The most complete post I have found on the topic. Thank you for the informative post. One thing I found an issue and not a lot of notes on it. For some reason using the id="xxxxx" in the servlet-mapping tag causes a JRUN 404 error for me. As soon as I removed the id's from both mappings it worked fine. Not sure why my config would be any different, I was using sequential ID's.
# Posted By Scott Berry | 5/5/09 7:00 PM
tony's Gravatar no problem! i was frustrated as you can imagine, that i was doing all the steps, but that last little one is VERY important! i use sequential, for sure, and just made sure there were no duplicates and it worked. either way, glad you got it figured out!
# Posted By tony | 5/5/09 7:36 PM
CAM's Gravatar What is the actual executable path for .cfm in the Application Mappings for CF8?

On another note, how do we map this if using Vista/IIS 7.0? The interface is quite different.

Thanks -
# Posted By CAM | 8/17/09 10:21 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.2.002. Contact Blog Owner
back to my home page back to my home page my clients my resume about me navtrak - gps tracking