Wednesday, March 21, 2007

accessing Coldfusion Components (CFC's) question

I haven't had any problems accessing my components (CFC's) when I use dot notation on my localhost, nor have I ever had problems using dot notation when I have a path mapping set up on a remote server. However, this (below) does not work when calling out components in an environment where a mapping is disallowed (shared environment, for instance, where you don't have access to CF adminstrator)-- I'm trying to get my process created in a way that doesn't require me to use full paths, for ANT builds, etc that can be ported to different machines).

Any suggestions for how to access components in a directory such as, for example, wwwroot/ApplicationName/Model/Components

where I cannot have a mapping setup? Is there a way to do this with CFOBJECT (in a modified format from below), or do I need to resort to CFINVOKE? If so, what would the path callout look like using CFOBJECT or CFINVOKE?:

<cfobject name="oContactData" component="ApplicationName.Model.Components.CFCmyprofile ">
<cfset qContacts = #oContactData.getMyContacts(SESSION.auth.SkillshowUserID, -1)#>

Looking for a modified line of the above code that works in a relative path manner-


Ben Nadel said...


This doesn't exactly handle "relative" paths, per-say, however, it can easily be set up to let Application handle the CFC creation. Take a look at this:

It details exactly the issue you are trying to overcome. I hate mapped paths... down with paths!

seancorfield said...

That absolutely should work - unless your hosting provider is stupid enough to have created a mapping for "/" which breaks CFC lookup.

Who is your shared hosting provider?

Mark Holton said...

Hi Ben, Sean,
Thanks for the info, and the confirmation. I'm going to give that a spin tonight. I might have some questions later!'s too bad this isn't built into CFC's in a more robust manner. It would seem that MVC, and the ability to access CFC's via relative paths would be a main requirement (for ANT builds, etc). If I'm missing something, someone please alert me. Ben's path looks like a good one to go down.

Thanks and cheers-

diana said...

A web hosting is the company that is responsible for displaying your website on the world wide web for everyone to see. They’re basically selling you space for your site to be displayed along with many other options. They usually will provide you with email accounts for your site, website statistics, a basic website builder program, customer support and many other tools.

SEO Services Consultants said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company

rocky case said...

Stephen Stapinski

Really your blog is very interesting.... it contains great and unique information. I enjoyed to visiting your blog. It's just amazing.... Thanks very much for the share.