CFC file not being processed properly in Railo when changes made to servlet-mapping in web.xml

StackOverflow https://stackoverflow.com/questions/22281765

  •  11-06-2023
  •  | 
  •  

Question

In order to play around with search engine friendly urls, I have added the following mappings to my web.xml:

<servlet-mapping>
        <servlet-name>CFMLServlet</servlet-name>
        <url-pattern>/mywebsitename.com/index.cfm/*</url-pattern>
        <url-pattern>/mywebsitename.com/posts/*</url-pattern>
    </servlet-mapping>

This has allowed me to work with urls like this mywebsitename.com/posts/my-first-post

However, one little glitch is occurring. If I try and access a CFC file that was working before, it now simply returns the html text of that CFC instead of actually processing it in Railo.

To explain it better, if I add the servlet-mapping above to web.xml and call mywebsite.com/Components/CFCProxy.cfc - the html of that cfc is returned.I would expect to see a Railo dump of the functions.

However, if I remove the servlet-mapping from the web.xml file, then when I access that same URL, I see the proper railo dump of the CFC functions that can be called, which is what I expect to see.

So without the servlet-mapping it works fine, but with the servlet, only html text of the CFC is returned.

So my guess is that by adding the servlet-mapping, I am disabling the processing of that CFC by Railo somehow. So all I would like to know is how to get that CFC file to process properly again? Do I need to add another line to the servlet-mapping for that and if so, what?

Thanks

Was it helpful?

Solution

I ran into this same issue recently.

Try adding

<url-pattern>*.cfm</url-pattern>
<url-pattern>*.cfc</url-pattern>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top