Difference between revisions of "Ajax Proxy"
(Created page with '==Overview== Ajax Proxy is a CFM file located in the /_cs_apps/ directory of your site (copy from the /ADF/core/site-sample/) directory. The concept of the Proxy is to have a si…') |
(→Example) |
||
Line 12: | Line 12: | ||
== Example== | == Example== | ||
+ | <code> | ||
jQuery.get("#application.ADF.ajaxProxy#", | jQuery.get("#application.ADF.ajaxProxy#", | ||
{ bean: "CSData_1_0", | { bean: "CSData_1_0", | ||
Line 19: | Line 20: | ||
function( results ) ... | function( results ) ... | ||
}); | }); | ||
+ | </code> | ||
== Configuring== | == Configuring== |
Revision as of 16:26, 18 December 2009
Contents
Overview
Ajax Proxy is a CFM file located in the /_cs_apps/ directory of your site (copy from the /ADF/core/site-sample/) directory. The concept of the Proxy is to have a single endpoint for all ajax calls into the ADF library and/or Apps that are built. The goal with this single endpoint is essentially 2 fold:
- Control security access to the methods within the ADF
- Load the site application space so that library and app calls can have site level context
Usage
To use the Ajax Proxy in a jQuery get/post call do the following:
- URL to call is #application.ADF.ajaxProxy#
- Add in the name of the bean you want to call
- Add in the name of the method within that bean you want to call
- Add any other parameters (which will be passed into your function)
Example
jQuery.get("#application.ADF.ajaxProxy#",
{ bean: "CSData_1_0", method: "getSubsiteStruct", subsiteURL: "#request.subsite.url#", returnFormat: "json" }, function( results ) ...
});
Configuring
To start using the Ajax Proxy, be sure to copy the ajaxProxy.cfm located in /ADF/core/site-sample/ into your sites /_cs_apps/ directory. Additionally, make sure that in your ADF.cfc (located in your /_cs_apps/ directory) you have the following line in your init() method:
setAjaxProxyURL("#request.site.csAppsWebURL#ajaxProxy.cfm");
after the "loadSite()" call
Make sure you Reset your Site ADF
Security
By default all methods within an application or the ADF library are locked down. To make a method available you must add it to either your applications Proxy White List (recommended) or the global Proxy White List.
You should also become familiar with the CS Security v1 component. If your method preforms potentially dangerous actions, you may also want to check to ensure that the call is being conducted by a licensed contributor or a site admin.