use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class Caster method otherTypeToClass.
private static Class<?> otherTypeToClass(String type) throws PageException, ClassException {
PageContext pc = ThreadLocalPageContext.get();
PageException pe = null;
// try to load as cfc
if (pc != null) {
try {
Component c = pc.loadComponent(type);
return ComponentUtil.getComponentPropertiesClass(pc, c);
} catch (PageException e) {
pe = e;
}
}
// try to load as class
try {
return ClassUtil.loadClass(type);
} catch (ClassException ce) {
if (pe != null)
throw pe;
throw ce;
}
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class SecurityManagerImpl method isValid.
private boolean isValid(Config config, Password spw) {
if (spw == null) {
try {
PageContextImpl pc = (PageContextImpl) ThreadLocalPageContext.get();
spw = pc.getServerPassword();
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
}
config = ThreadLocalPageContext.getConfig(config);
if (config == null || spw == null)
return false;
try {
ConfigImpl.getConfigServer(config, spw);
return true;
} catch (PageException e) {
return false;
}
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class Admin method getSSLCertificate.
public static Query getSSLCertificate(Config config, String host, int port) throws PageException {
Resource cacerts = config.getSecurityDirectory();
CertificateInstaller installer;
try {
installer = new CertificateInstaller(cacerts, host, port);
} catch (Exception e) {
throw Caster.toPageException(e);
}
X509Certificate[] certs = installer.getCertificates();
X509Certificate cert;
Query qry = new QueryImpl(new String[] { "subject", "issuer" }, certs.length, "certificates");
for (int i = 0; i < certs.length; i++) {
cert = certs[i];
qry.setAtEL("subject", i + 1, cert.getSubjectDN().getName());
qry.setAtEL("issuer", i + 1, cert.getIssuerDN().getName());
}
return qry;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class Admin method doReadBundle.
private void doReadBundle() throws PageException {
String ret = getString("admin", action, "returnvariable");
Resource res = ResourceUtil.toResourceExisting(pageContext, getString("admin", action, "bundle"));
if (!res.isFile())
throw new ApplicationException("[" + res + "] is not a file");
try {
Struct sct = new StructImpl();
pageContext.setVariable(ret, new BundleFile(res).info());
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class Admin method doUpdateFLD.
private void doUpdateFLD() throws PageException {
try {
String jar = getString("jar", null);
if (!StringUtil.isEmpty(jar, true)) {
Resource resJar = ResourceUtil.toResourceExisting(pageContext, jar);
admin.updateJar(resJar);
}
Resource resFld = ResourceUtil.toResourceExisting(pageContext, getString("admin", action, "fld"));
admin.updateFLD(resFld);
} catch (Exception e) {
throw Caster.toPageException(e);
}
store();
}
Aggregations