public static Struct call(PageContext pc) {
return call(pc, false);
}
public static Struct call(PageContext pc, boolean suppressFunctions) {
ApplicationContextPro ac = (ApplicationContextPro) pc.getApplicationContext();
Component cfc = null;
if(ac instanceof ModernApplicationContext)cfc= ((ModernApplicationContext)ac).getComponent();
Struct sct=new StructImpl();
sct.setEL("applicationTimeout", ac.getApplicationTimeout());
sct.setEL("clientManagement", Caster.toBoolean(ac.isSetClientManagement()));
sct.setEL("clientStorage", ac.getClientstorage());
sct.setEL("sessionStorage", ac.getSessionstorage());
sct.setEL("customTagPaths", toArray(ac.getCustomTagMappings()));
sct.setEL("loginStorage", AppListenerUtil.translateLoginStorage(ac.getLoginStorage()));
sct.setEL(KeyConstants._mappings, toStruct(ac.getMappings()));
sct.setEL(KeyConstants._name, ac.getName());
sct.setEL("scriptProtect", AppListenerUtil.translateScriptProtect(ac.getScriptProtect()));
sct.setEL("secureJson", Caster.toBoolean(ac.getSecureJson()));
sct.setEL("secureJsonPrefix", ac.getSecureJsonPrefix());
sct.setEL("sessionManagement", Caster.toBoolean(ac.isSetSessionManagement()));
sct.setEL("sessionTimeout", ac.getSessionTimeout());
sct.setEL("clientTimeout", ac.getClientTimeout());
sct.setEL("setClientCookies", Caster.toBoolean(ac.isSetClientCookies()));
sct.setEL("setDomainCookies", Caster.toBoolean(ac.isSetDomainCookies()));
sct.setEL(KeyConstants._name, ac.getName());
sct.setEL("localMode", ac.getLocalMode()==Undefined.MODE_LOCAL_OR_ARGUMENTS_ALWAYS?Boolean.TRUE:Boolean.FALSE);
sct.setEL(KeyConstants._locale,LocaleFactory.toString(pc.getLocale()));
sct.setEL(KeyConstants._timezone,TimeZoneUtil.toString(pc.getTimeZone()));
sct.setEL("sessionType", ((PageContextImpl) pc).getSessionType()==ConfigImpl.SESSION_TYPE_CFML?"cfml":"j2ee");
sct.setEL("serverSideFormValidation", Boolean.FALSE); // TODO impl
sct.setEL("clientCluster", Caster.toBoolean(ac.getClientCluster()));
sct.setEL("sessionCluster", Caster.toBoolean(ac.getSessionCluster()));
sct.setEL("invokeImplicitAccessor", Caster.toBoolean(ac.getTriggerComponentDataMember()));
sct.setEL("triggerDataMember", Caster.toBoolean(ac.getTriggerComponentDataMember()));
sct.setEL("sameformfieldsasarray", Caster.toBoolean(ac.getSameFieldAsArray(Scope.SCOPE_FORM)));
sct.setEL("sameurlfieldsasarray", Caster.toBoolean(ac.getSameFieldAsArray(Scope.SCOPE_URL)));
Object ds = ac.getDefDataSource();
if(ds instanceof DataSource) ds=_call((DataSource)ds);
else ds=Caster.toString(ds,null);
sct.setEL(KeyConstants._datasource, ds);
sct.setEL("defaultDatasource", ds);
Resource src = ac.getSource();
if(src!=null)sct.setEL(KeyConstants._source,src.getAbsolutePath());
// orm
if(ac.isORMEnabled()){
ORMConfiguration conf = ac.getORMConfiguration();
if(conf!=null)sct.setEL(KeyConstants._orm, conf.toStruct());
}
// s3
Properties props = ac.getS3();
if(props!=null) {
sct.setEL(KeyConstants._s3, props.toStruct());
}
// datasources
DataSource[] sources = ac.getDataSources();
if(!ArrayUtil.isEmpty(sources)){
Struct _sources = new StructImpl(),s;
sct.setEL(KeyConstants._datasources, _sources);
for(int i=0;i<sources.length;i++){
_sources.setEL(KeyImpl.init(sources[i].getName()), _call(sources[i]));
}
}
//cache
String func = ac.getDefaultCacheName(Config.CACHE_DEFAULT_FUNCTION);
String obj = ac.getDefaultCacheName(Config.CACHE_DEFAULT_OBJECT);
String qry = ac.getDefaultCacheName(Config.CACHE_DEFAULT_QUERY);
String res = ac.getDefaultCacheName(Config.CACHE_DEFAULT_RESOURCE);
String tmp = ac.getDefaultCacheName(Config.CACHE_DEFAULT_TEMPLATE);
if(func!=null || obj!=null || qry!=null || res!=null || tmp!=null) {
Struct cache=new StructImpl();
sct.setEL(KeyConstants._cache, cache);
if(func!=null)cache.setEL(KeyConstants._function, func);
if(obj!=null)cache.setEL(KeyConstants._object, obj);
if(qry!=null)cache.setEL(KeyConstants._query, qry);
if(res!=null)cache.setEL(KeyConstants._resource, res);
if(tmp!=null)cache.setEL(KeyConstants._template, tmp);
}
// java settings
JavaSettings js = ac.getJavaSettings();
StructImpl jsSct = new StructImpl();
jsSct.put("loadCFMLClassPath",js.loadCFMLClassPath());
jsSct.put("reloadOnChange",js.reloadOnChange());
jsSct.put("watchInterval",new Double(js.watchInterval()));
jsSct.put("watchExtensions",ListUtil.arrayToList(js.watchedExtensions(),","));