[jQuery] Re: Coldfusion: using $.get() to directly call a CFC living outside of the webroot

2007-04-05 Thread Josh Nathanson
Andy, Ben Nadel has some information about calling CFCs outside the webroot, 
without a mapping, on his blog.  It may be of help to you.  I think there is 
still some mediation that happens but I don't think you have to use a 
middle-man file. 

-- Josh


- Original Message - 
  From: Andy Matthews 
  To: jquery-en@googlegroups.com 
  Sent: Thursday, April 05, 2007 11:16 AM
  Subject: [jQuery] Coldfusion: using $.get() to directly call a CFC living 
outside of the webroot


  Right now m JS looks like this:

  $.get(psychic.cfm, {method:idArr[0],key:idArr[1]}, function(data){
  //do some stuff
  });

  psychic.cfm contains the following code:
  cfset VARIABLES.ps = CreateObject(component,includes.salesman)
  cfparam name=URL.method default=
  cfparam name=URL.key default=
  cfset func = VARIABLES.ps[URL.method]
  cfoutput#func(URL.key)#/cfoutput

  It's the only way that I can think of to call a CFC outside of my webroot. I 
don't like having to do this as it requires a middle-man page. The upside is 
that it works flawlessly.

  I do have a mapping to the CFC directory (not the one above):
  apps.cfcs.theCFCinQuestion

  Is there any way to call against that CFC directly instead of having to use a 
middle page?

  

  Andy Matthews
  Senior Coldfusion Developer

  Office:  877.707.5467 x747
  Direct:  615.627.9747
  Fax:  615.467.6249
  [EMAIL PROTECTED]
  www.dealerskins.com


dealerskinslogo.bmp
Description: Windows bitmap


[jQuery] Re: Coldfusion: using $.get() to directly call a CFC living outside of the webroot

2007-04-05 Thread Andy Matthews
Okay...I'll post this question to the cf-talk list as well.

  _  

From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh Nathanson
Sent: Thursday, April 05, 2007 1:39 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Coldfusion: using $.get() to directly call a CFC
living outside of the webroot


Andy, Ben Nadel has some information about calling CFCs outside the webroot,
without a mapping, on his blog.  It may be of help to you.  I think there is
still some mediation that happens but I don't think you have to use a
middle-man file. 
 
-- Josh
 
 
- Original Message - 

From: Andy Matthews mailto:[EMAIL PROTECTED]  
To: jquery-en@googlegroups.com 
Sent: Thursday, April 05, 2007 11:16 AM
Subject: [jQuery] Coldfusion: using $.get() to directly call a CFC living
outside of the webroot

Right now m JS looks like this:
 
$.get(psychic.cfm, {method:idArr[0],key:idArr[1]}, function(data){
//do some stuff
});
 
psychic.cfm contains the following code:
cfset VARIABLES.ps = CreateObject(component,includes.salesman)
cfparam name=URL.method default=
cfparam name=URL.key default=
cfset func = VARIABLES.ps[URL.method]
cfoutput#func(URL.key)#/cfoutput
 
It's the only way that I can think of to call a CFC outside of my webroot. I
don't like having to do this as it requires a middle-man page. The upside is
that it works flawlessly.
 
I do have a mapping to the CFC directory (not the one above):
apps.cfcs.theCFCinQuestion
 
Is there any way to call against that CFC directly instead of having to use
a middle page?
 


 
Andy Matthews
Senior Coldfusion Developer

Office:  877.707.5467 x747
Direct:  615.627.9747
Fax:  615.467.6249
[EMAIL PROTECTED]
www.dealerskins.com http://www.dealerskins.com/ 
 



dealerskinslogo.bmp
Description: Windows bitmap


[jQuery] Re: Coldfusion: using $.get() to directly call a CFC living outside of the webroot

2007-04-05 Thread Josh Nathanson
As an aside, Rob Gonda's AjaxCFC handles numbers 2 and 3 below nicely, and he's 
built a hook into jquery into the latest version.  You can set the return type 
to JSON or WDDX, and it will report a nice error message for you if there's an 
error in your cfc.  Not sure how that would tie in with the need for a facade, 
but it could probably be integrated.

-- Josh

  - Original Message - 
  From: Dan G. Switzer, II 
  To: jquery-en@googlegroups.com 
  Sent: Thursday, April 05, 2007 12:12 PM
  Subject: [jQuery] Re: Coldfusion: using $.get() to directly call a CFC living 
outside of the webroot


  Andy,

   

  I actually prefer using a façade (which is you're doing) for a few reasons:

   

  1)   You're preventing direct access to the CFC. While I do use CFC for 
Webservices, the CFCs I expose are usually façades for an internal API with 
limited roles and access. 

  2)   Calling a CFC directly returns the results as WDDX (at least in CF7 
and earlier.) I prefer using JSON-because it's lighter weight. A simple data 
structure in WDDX can produce a pretty large data packet, where the same packet 
in JSON is considerable smaller.

  3)   I can build whatever additional error handling for the AJAX call 
into the façade. I mean, what happens if your CFC throws an error? I want to 
make sure that my AJAX calls now what do to if something funky happens.

   

  -Dan