Ajax Proxy
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 two-fold:
- Control security access to the methods within the ADF
- Load the site application space so library and app calls 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.
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.