use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Admin method doGetError.
private void doGetError() throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
// sct.set("errorTemplate",config.getErrorTemplate());
Struct templates = new StructImpl();
Struct str = new StructImpl();
sct.set(TEMPLATES, templates);
sct.set(STR, str);
sct.set(DO_STATUS_CODE, Caster.toBoolean(config.getErrorStatusCode()));
// 500
String template = config.getErrorTemplate(500);
try {
PageSource ps = ((PageContextImpl) pageContext).getPageSourceExisting(template);
if (ps != null)
templates.set("500", ps.getDisplayPath());
else
templates.set("500", "");
} catch (PageException e) {
templates.set("500", "");
}
str.set("500", template);
// 404
template = config.getErrorTemplate(404);
try {
PageSource ps = ((PageContextImpl) pageContext).getPageSourceExisting(template);
if (ps != null)
templates.set("404", ps.getDisplayPath());
else
templates.set("404", "");
} catch (PageException e) {
templates.set("404", "");
}
str.set("404", template);
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Admin method doGetUpdate.
/**
* @throws PageException
*/
private void doGetUpdate() throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
URL location = config.getUpdateLocation();
if (location == null)
location = Constants.DEFAULT_UPDATE_URL;
String type = config.getUpdateType();
if (StringUtil.isEmpty(type))
type = "manual";
sct.set("location", location.toExternalForm());
sct.set("type", type);
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Admin method doGetMailSetting.
/**
* @throws PageException
*/
private void doGetMailSetting() throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
int maxThreads = 20;
SpoolerEngine engine = config.getSpoolerEngine();
if (engine instanceof SpoolerEngineImpl) {
maxThreads = ((SpoolerEngineImpl) engine).getMaxThreads();
}
sct.set("spoolEnable", Caster.toBoolean(config.isMailSpoolEnable()));
sct.set("spoolInterval", Caster.toInteger(config.getMailSpoolInterval()));
sct.set("maxThreads", Caster.toDouble(maxThreads));
sct.set("timeout", Caster.toInteger(config.getMailTimeout()));
sct.set("defaultencoding", config.getMailDefaultCharset().name());
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Admin method _fillSecData.
private void _fillSecData(SecurityManager sm) throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
sct.set("cfx_setting", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CFX_SETTING) == SecurityManager.VALUE_YES));
sct.set("cfx_usage", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CFX_USAGE) == SecurityManager.VALUE_YES));
sct.set("custom_tag", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_CUSTOM_TAG) == SecurityManager.VALUE_YES));
sct.set(KeyConstants._datasource, _fillSecDataDS(sm.getAccess(SecurityManager.TYPE_DATASOURCE)));
sct.set("debugging", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_DEBUGGING) == SecurityManager.VALUE_YES));
sct.set("direct_java_access", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_DIRECT_JAVA_ACCESS) == SecurityManager.VALUE_YES));
sct.set("mail", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_MAIL) == SecurityManager.VALUE_YES));
sct.set(KeyConstants._mapping, Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_MAPPING) == SecurityManager.VALUE_YES));
sct.set("remote", Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_REMOTE) == SecurityManager.VALUE_YES));
sct.set("setting", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SETTING) == SecurityManager.VALUE_YES));
sct.set("search", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SEARCH) == SecurityManager.VALUE_YES));
sct.set("scheduled_task", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_SCHEDULED_TASK) == SecurityManager.VALUE_YES));
sct.set(KeyConstants._cache, Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_CACHE) == SecurityManager.VALUE_YES));
sct.set("gateway", Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_GATEWAY) == SecurityManager.VALUE_YES));
sct.set(KeyConstants._orm, Caster.toBoolean(sm.getAccess(SecurityManagerImpl.TYPE_ORM) == SecurityManager.VALUE_YES));
sct.set("tag_execute", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_EXECUTE) == SecurityManager.VALUE_YES));
sct.set("tag_import", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_IMPORT) == SecurityManager.VALUE_YES));
sct.set("tag_object", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_OBJECT) == SecurityManager.VALUE_YES));
sct.set("tag_registry", Caster.toBoolean(sm.getAccess(SecurityManager.TYPE_TAG_REGISTRY) == SecurityManager.VALUE_YES));
sct.set("access_read", SecurityManagerImpl.toStringAccessRWValue(sm.getAccess(SecurityManager.TYPE_ACCESS_READ)));
sct.set("access_write", SecurityManagerImpl.toStringAccessRWValue(sm.getAccess(SecurityManager.TYPE_ACCESS_WRITE)));
short accessFile = sm.getAccess(SecurityManager.TYPE_FILE);
String str = SecurityManagerImpl.toStringAccessValue(accessFile);
if (str.equals("yes"))
str = "all";
sct.set(KeyConstants._file, str);
Array arr = new ArrayImpl();
if (accessFile != SecurityManager.VALUE_ALL) {
Resource[] reses = ((SecurityManagerImpl) sm).getCustomFileAccess();
for (int i = 0; i < reses.length; i++) {
arr.appendEL(reses[i].getAbsolutePath());
}
}
sct.set("file_access", arr);
}
use of lucee.runtime.type.StructImpl in project Lucee by lucee.
the class Admin method doGetTaskSetting.
private void doGetTaskSetting() throws PageException {
Struct sct = new StructImpl();
pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
int maxThreads = 20;
SpoolerEngine engine = config.getSpoolerEngine();
if (engine instanceof SpoolerEngineImpl) {
SpoolerEngineImpl ei = ((SpoolerEngineImpl) engine);
maxThreads = ei.getMaxThreads();
}
sct.set("maxThreads", Caster.toDouble(maxThreads));
}
Aggregations