Skip navigation
MIsterS33
Currently Being Moderated

Apache ColdFusion 10 Process .HTML Files Containing CFML

Dec 25, 2012 9:50 AM

Tags: #html #apache #cfml #cf10 #mountain-lion

I am on Mac Mountain Lion, but that shouldn't make a difference.

 

This is for a clients website, so I need to get this working ASAP.

 

Any advice on how to get CF 10 working with this setup, only serving .html files that contain CFML?


So far I have tried:

1. Adding /*.html = cfusion and /*.htm = cfusion to my uriworkermap_cfusion.properties file.


2. Adding .htm and .html to the AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf line in my apache conf file.


.cfm files and CF Admin render correctly, but when I call a .html file that contains CFML I get a Tomcat error saying the requested resource is not available.

 

Thanks for any advice on this, I am out of ideas.

I've had no trouble getting this to work on Windows, IIS and CF10.

 
Replies
  • Currently Being Moderated
    Dec 26, 2012 2:11 AM   in reply to MIsterS33

    I am on a different system, but my guess is that:

     

    1) the properties file should contain the lines

     

    /*.cfm = cfusion

    /*.html = cfusion

    /*.htm = cfusion

     

    2) you should save the file as uriworkermap.properties;

     

    3) The intention now is to edit system file /WEB-INF/web.xml, by adding html and htm mappings to it. First and foremost, back-up the file, just in case. 

     

    Open the web.xml file in a text editor. Locate the elements whose IDs are of the form "coldfusion_mapping_x", where x is a number in the set {0,1,2,...}. Locate the highest such number. Let's call it X. The ID of a new ColdFusion mapping will therefore begin with X+1.

     

    Now, edit the web.xml file by adding the following 2 new mappings immediately after mapping number X (replacing X with the actual value!):

     

    <servlet-mapping id="coldfusion_mapping_X+1">

        <servlet-name>CfmServlet</servlet-name>

        <url-pattern>*.html/*</url-pattern>

    </servlet-mapping>

    <servlet-mapping id="coldfusion_mapping_X+2">

        <servlet-name>CfmServlet</servlet-name>

        <url-pattern>*.htm/*</url-pattern>

    </servlet-mapping>

     

    To illustrate, on my system the highest number in the IDs of the form "coldfusion_mapping_x" is 15. So, for me, X is 15. Therefore, if I followed the above instructions, I would have to add the following 2 mappings immediately after mapping number 15:

     

    <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>

     

    Save the edited web.xml file.

     

    4) Restart ColdFusion.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 26, 2012 11:50 AM   in reply to MIsterS33

    MIsterS33 wrote:

     

    Thanks for the help, but in my original post I mentioned that I had already tried steps 1 and 2 of your post ( adding the entries to the properties file ).

    OK. The idea was just to confirm.

    Are you on ColdFusion 10? I have CF10 installed on three different machines and none of them have servlet mappings for ColdFusion in the web.xml file. I have seen these mappings in all JRun versions of CF, but not CF10.

    I am on ColdFusion 10 and Windows 7 Ultimate. the location of my web.xml file is C:\ColdFusion10\cfusion\wwwroot\WEB-INF\web.xml.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 26, 2012 1:36 PM   in reply to MIsterS33

    MIsterS33 wrote:

     

    There are two web.xml files and the one I was looking at is the ColdFusion10\cfusion\runtime\conf\web.xml.


    After I put those servlet mappings in there it started working. Thanks for you're help. I figured it was something staring me right in the face, but I had been trying to get it working for a couple of days now.

     

    Thanks again.

     

    For anyone else that is reading, the fix was to do step 3 of BKBK's post above, but in the web.xml file located in the wwwroot\WEB-INF folder.

    Please kindly mark this as the answer. It will surely help someone else in future.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points