Note: This blog post is from 2007. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.As folks contemplate moving to CF8 from 6 or 7, they may know that they can run these releases alongside each other--as long as you use a separate web server (or web site in servers that support it) configured to hand CFML requests to each CF server. Since CF6, CF has included a built-in web server to help with this very issue, especially on servers (like IIS on XP) where you can't have more than one site.
But what if you want to test some code in a single directory against one or more editions? Is that possible? I mean, let's say you have CF7 setup against IIS, and your code is in the c:\inetpub\wwwroot? And you've installed CF 8 for testing using its built-in web server, which runs on port 8500 (or whatever you chose) and finds its code in, for instance, c:\coldfusion8\wwwroot.
How would you have CF8 look at the code you've long had running in the IIS root? (or Apache, or a virtual directory you've setup for use by either external web server). Do you have to move the code around among these directories to test it on different versions of CF? No, you don't.
The trick is in the jrun-web.xml, which you can find in cfusionmx_home]\wwwroot\WEB-INF\jrun-web.xml . You can add a new "virtual-mapping" entry there, naming a new "alias" which points to files outside the normal CF-based wwwroot:
So now a request for http://localhost:8500/inet/ will look instead in the inetpub/wwwroot, or wherever you point it.
Update: Note that when you use the resource-path, it's case-sensitive, even on Windows, so http://localhost:8500/INET/ would not be the same.
Of course, this works also if you set up CF8 to run via your built-in web server, but setup CF 7 or 6 to run on its own built-in web server. And of course, if you're savvy enough you may figure out how to run things so that you can run all 3 using an external web server.
There are a couple of potential challenges with this technique. For one thing, if your code has hard-coded references (such as hyperlinks, images, CFLOCATIONS, etc.) to either run on a particular host (without the port) or at a particular root-relative path, then this introduction of a new port or the /inet/ alias may hamper it working. That's not a "CF" problem but rather a coding one. Your stuck then.
But it certainly works well for testing individual files. I do it all the time and have for years. Indeed, I'll share, for the sake of posterity, that this modifying of the jrun-web.xml is something I first wrote about back in 2002, but many may have missed when such info was being shared.
I'm going to go back and reprise a lot of those "oldies but goodies", spread across a few different blogs I've had over the past several years. I think I'll call them "carehart classics".
For more content like this:
Need more help with problems?
- Signup to get my blog posts by email:
- Follow my blog RSS feed
- View the rest of my blog posts
- View my blog posts on the Adobe CF portal
- If you may prefer direct help, rather than digging around here/elsewhere or via comments, I can help via my consulting services
- See that for more on how I can help a) over the web, safely and securely, b) usually very quickly, c) teaching you as we go, and d) with satisfaction guaranteed