Virtual Mapping in ColdFusion 8

I was setting up the ColdFusion 8 server on my new Mac Pro today and am using the development server now in lieu of IIS which I always used on my Windows dev boxes previously. When setting up a virtual directory, I'd always just set it up through IIS. Setting up virtual directories in ColdFusion was a bit of a change for me, and after an hour of head scratching when my CF mapping didn't work when trying to call CFM files through browser, I figured out the following to setup a virtual directory for built-in ColdFusion development server:

1) Open up the jrun-web.xml file located in ColdFusion8/wwwroot/WEB-INF directory.
2) Add a virtual directory mapping as follows:

  <virtual-mapping>
<resource-path>/cf/*</resource-path>
<system-path>/Users/meutznerb/Documents/dev_flex3/CFMiddleTier/</system-path>
</virtual-mapping>

3) Save the file, and restart the CF server instance.

The mapping above will now allow me to call files from

http://localhost:8500/cf/
and reference the CFMiddleTier directory in my Documents/dev_flex3 directory.

The trick was getting the directory path correct... starting from /Documents/... would not work, and required the full path with /Users/meutznerb/Documents/... to be defined.

That's my mac newbie tip for the day :-)

ColdFusion 8 released

http://www.adobe.com/products/coldfusion/

A debugger... thank the gods!!!

Export to Excel with Flex 2.0 and ColdFusion

Hi,

I didn't really find a suitable solution for exporting to Excel after a bit of searching through forums and blogs, so I came up with the following. I wanted to achieve seamless "click to generate a report" from Flex and have the file option dialog popup in the browser allowing me to open or save. Here's what I came up with. While I don't see any issues with the solution, I realize it's a bit of a hack, and would appreciate any CF wizards letting me know if this is going to create problems.

From Flex, I'm calling a CFC function with my data being passed back as an array. The CFC takes the data and stores it to an application variable in CF. I then send a trivial result back to Flex. On the CFC result inside Flex, I make a call to a template CFM file which uses the cfcontent tag to generate the excel file from an html table structure I build with the saved application variable data.

CFC

<cffunction name="exportToExcel" access="remote" returntype="any" output="true">
<cfargument name="data" type="array" required="yes" default="" />
<cfset session.exportData = #ArrayNew(1)#>
<cfreturn 'true'>
</cffunction>


Flex

if(event.result == 'true')
{
var request:URLRequest = new URLRequest(URLToCFTemplate);
flash.net.navigateToURL(request, "_self");
}


Brendan

Updated: Download the source files here - Download

Named Parameters in ColdFusion

BlogCFC was created by Raymond Camden. This blog is running version 5.005.