use of lucee.runtime.PageSource in project Lucee by lucee.
the class CFMLExpressionInterpreter method identifier.
/**
* Liest einen Identifier aus und gibt diesen als String zurueck.
* <br />
* EBNF:<br />
* <code>(letter | "_") {letter | "_"|digit};</code>
* @param firstCanBeNumber
* @return Identifier.
*/
private String identifier(boolean firstCanBeNumber) {
if (!cfml.isCurrentLetter() && !cfml.isCurrentSpecial()) {
if (!firstCanBeNumber)
return null;
else if (!cfml.isCurrentDigit())
return null;
}
boolean doUpper;
PageSource ps = pc == null ? null : pc.getCurrentPageSource();
if (ps != null)
doUpper = !isJson && ps.getDialect() == CFMLEngine.DIALECT_CFML && ((MappingImpl) ps.getMapping()).getDotNotationUpperCase();
else
// MUST .lucee should not be upper case
doUpper = !isJson && ((ConfigWebImpl) config).getDotNotationUpperCase();
StringBuilder sb = new StringBuilder();
sb.append(doUpper ? cfml.getCurrentUpper() : cfml.getCurrent());
do {
cfml.next();
if (!(cfml.isCurrentLetter() || cfml.isCurrentDigit() || cfml.isCurrentSpecial())) {
break;
}
sb.append(doUpper ? cfml.getCurrentUpper() : cfml.getCurrent());
} while (cfml.isValidIndex());
// cfml.substringLower(start,cfml.getPos()-start);
return sb.toString();
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class AppListenerUtil method getApplicationPageSourceCurr2Root.
public static PageSource getApplicationPageSourceCurr2Root(PageContext pc, PageSource requestedPage, String filename) {
PageSource ps = requestedPage.getRealPage(filename);
if (ps.exists()) {
return ps;
}
Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(requestedPage.getRealpathWithVirtual(), "/");
// Config config = pc.getConfig();
for (int i = arr.size() - 1; i > 0; i--) {
StringBuilder sb = new StringBuilder("/");
for (int y = 1; y < i; y++) {
sb.append((String) arr.get(y, ""));
sb.append('/');
}
sb.append(filename);
ps = ((PageContextImpl) pc).getPageSourceExisting(sb.toString());
if (ps != null) {
return ps;
}
}
return null;
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class ClassicAppListener method _onRequest.
static void _onRequest(PageContext pc, PageSource requestedPage, PageSource application, RequestListener rl) throws PageException {
PageContextImpl pci = (PageContextImpl) pc;
pci.setAppListenerType(ApplicationListener.TYPE_CLASSIC);
// on requestStart
if (application != null)
pci._doInclude(new PageSource[] { application }, false, null);
if (rl != null) {
requestedPage = rl.execute(pc, requestedPage);
if (requestedPage == null)
return;
}
// request
try {
pci._doInclude(new PageSource[] { requestedPage }, false, null);
} catch (MissingIncludeException mie) {
ApplicationContext ac = pc.getApplicationContext();
boolean rethrow = true;
if (ac instanceof ClassicApplicationContext) {
ClassicApplicationContext cfc = (ClassicApplicationContext) ac;
UDF udf = cfc.getOnMissingTemplate();
if (udf != null) {
String targetPage = requestedPage.getRealpathWithVirtual();
rethrow = (!Caster.toBooleanValue(udf.call(pc, new Object[] { targetPage }, true), true));
}
}
if (rethrow)
throw mie;
}
// on Request End
if (application != null) {
PageSource onReqEnd = application.getRealPage(Constants.CFML_CLASSIC_APPLICATION_END_EVENT_HANDLER);
if (onReqEnd.exists())
pci._doInclude(new PageSource[] { onReqEnd }, false, null);
}
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class MixedAppListener method getApplicationPageSourceCurrToRoot.
private static PageSource getApplicationPageSourceCurrToRoot(PageContext pc, PageSource requestedPage, RefBoolean isCFC) {
PageSource res = getApplicationPageSourceCurrent(requestedPage, isCFC);
if (res != null)
return res;
Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(requestedPage.getRealpathWithVirtual(), "/");
// Config config = pc.getConfig();
String path;
for (int i = arr.size() - 1; i > 0; i--) {
StringBuilder sb = new StringBuilder("/");
for (int y = 1; y < i; y++) {
sb.append((String) arr.get(y, ""));
sb.append('/');
}
path = sb.toString();
res = ((PageContextImpl) pc).getPageSourceExisting(path.concat(Constants.CFML_APPLICATION_EVENT_HANDLER));
if (res != null) {
isCFC.setValue(true);
return res;
}
res = ((PageContextImpl) pc).getPageSourceExisting(path.concat(Constants.CFML_CLASSIC_APPLICATION_EVENT_HANDLER));
if (res != null)
return res;
}
return null;
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class MixedAppListener method getApplicationPageSourceCurrent.
private static PageSource getApplicationPageSourceCurrent(PageSource requestedPage, RefBoolean isCFC) {
PageSource res = requestedPage.getRealPage(Constants.CFML_APPLICATION_EVENT_HANDLER);
if (res.exists()) {
isCFC.setValue(true);
return res;
}
res = requestedPage.getRealPage(Constants.CFML_CLASSIC_APPLICATION_EVENT_HANDLER);
if (res.exists())
return res;
return null;
}
Aggregations