use of lucee.runtime.PageSource in project Lucee by lucee.
the class AppListenerUtil method setORMConfiguration.
public static void setORMConfiguration(PageContext pc, ApplicationContext ac, Struct sct) throws PageException {
if (sct == null)
sct = new StructImpl();
ConfigImpl config = (ConfigImpl) pc.getConfig();
PageSource curr = pc.getCurrentTemplatePageSource();
Resource res = curr == null ? null : curr.getResourceTranslated(pc).getParentResource();
ac.setORMConfiguration(ORMConfigurationImpl.load(config, ac, sct, res, config.getORMConfig()));
// datasource
Object o = sct.get(KeyConstants._datasource, null);
if (o != null) {
o = toDefaultDatasource(config, o, LogUtil.getLog(pc, "application"));
if (o != null)
ac.setORMDataSource(o);
}
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class ClassicAppListener method onRequest.
@Override
public void onRequest(PageContext pc, PageSource requestedPage, RequestListener rl) throws PageException {
PageSource application = AppListenerUtil.getApplicationPageSource(pc, requestedPage, Constants.CFML_CLASSIC_APPLICATION_EVENT_HANDLER, mode);
_onRequest(pc, requestedPage, application, rl);
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class MixedAppListener method onRequest.
@Override
public void onRequest(PageContext pc, PageSource requestedPage, RequestListener rl) throws PageException {
RefBoolean isCFC = new RefBooleanImpl(false);
PageSource appPS = getApplicationPageSource(pc, requestedPage, mode, isCFC);
if (isCFC.toBooleanValue())
_onRequest(pc, requestedPage, appPS, rl);
else
ClassicAppListener._onRequest(pc, requestedPage, appPS, rl);
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class MixedAppListener method getApplicationPageSourceRoot.
private static PageSource getApplicationPageSourceRoot(PageContext pc, RefBoolean isCFC) {
PageSource ps = ((PageContextImpl) pc).getPageSourceExisting("/" + Constants.CFML_APPLICATION_EVENT_HANDLER);
if (ps != null) {
isCFC.setValue(true);
return ps;
}
ps = ((PageContextImpl) pc).getPageSourceExisting("/" + Constants.CFML_CLASSIC_APPLICATION_EVENT_HANDLER);
if (ps != null)
return ps;
return null;
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class CFImportTag method initFile.
@Override
public void initFile() throws PageException {
ConfigWeb config = pageContext.getConfig();
// = appendix+'.'+config.getCFMLExtension();
String[] filenames = CustomTagUtil.getFileNames(config, getAppendix());
String strRealPathes = attributesScope.remove("__custom_tag_path").toString();
String[] realPathes = ListUtil.listToStringArray(strRealPathes, File.pathSeparatorChar);
for (int i = 0; i < realPathes.length; i++) {
if (!StringUtil.endsWith(realPathes[i], '/'))
realPathes[i] = realPathes[i] + "/";
}
// MUSTMUST use cache like regular ct
// page source
PageSource ps;
for (int rp = 0; rp < realPathes.length; rp++) {
for (int fn = 0; fn < filenames.length; fn++) {
ps = ((PageContextImpl) pageContext).getRelativePageSourceExisting(realPathes[rp] + filenames[fn]);
if (ps != null) {
source = new InitFile(pageContext, ps, filenames[fn]);
return;
}
}
}
// EXCEPTION
// message
StringBuffer msg = new StringBuffer("could not find template [");
msg.append(CustomTagUtil.getDisplayName(config, getAppendix()));
msg.append("] in the following directories [");
msg.append(strRealPathes.replace(File.pathSeparatorChar, ','));
msg.append(']');
throw new ExpressionException(msg.toString());
}
Aggregations