Search in sources :

Example 21 with PageException

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;
    }
}
Also used : PageException(lucee.runtime.exp.PageException) ClassException(lucee.commons.lang.ClassException) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) PageContext(lucee.runtime.PageContext) Component(lucee.runtime.Component)

Example 22 with PageException

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;
    }
}
Also used : PageException(lucee.runtime.exp.PageException) PageContextImpl(lucee.runtime.PageContextImpl)

Example 23 with PageException

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;
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) Query(lucee.runtime.type.Query) Resource(lucee.commons.io.res.Resource) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) X509Certificate(java.security.cert.X509Certificate) CertificateInstaller(lucee.runtime.net.http.CertificateInstaller)

Example 24 with PageException

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);
    }
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) StructImpl(lucee.runtime.type.StructImpl) Resource(lucee.commons.io.res.Resource) BundleFile(lucee.runtime.osgi.BundleFile) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException) Struct(lucee.runtime.type.Struct)

Example 25 with PageException

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();
}
Also used : Resource(lucee.commons.io.res.Resource) PageException(lucee.runtime.exp.PageException) SecurityException(lucee.runtime.exp.SecurityException) IOException(java.io.IOException) DeprecatedException(lucee.runtime.exp.DeprecatedException) BundleException(org.osgi.framework.BundleException) MalformedURLException(java.net.MalformedURLException) SMTPException(lucee.runtime.net.mail.SMTPException) ApplicationException(lucee.runtime.exp.ApplicationException)

Aggregations

PageException (lucee.runtime.exp.PageException)200 ApplicationException (lucee.runtime.exp.ApplicationException)56 IOException (java.io.IOException)54 Struct (lucee.runtime.type.Struct)49 StructImpl (lucee.runtime.type.StructImpl)37 ExpressionException (lucee.runtime.exp.ExpressionException)32 Resource (lucee.commons.io.res.Resource)30 SecurityException (lucee.runtime.exp.SecurityException)26 BundleException (org.osgi.framework.BundleException)26 MalformedURLException (java.net.MalformedURLException)25 Array (lucee.runtime.type.Array)21 Key (lucee.runtime.type.Collection.Key)17 PageRuntimeException (lucee.runtime.exp.PageRuntimeException)15 SAXException (org.xml.sax.SAXException)15 Entry (java.util.Map.Entry)14 ClassException (lucee.commons.lang.ClassException)14 DeprecatedException (lucee.runtime.exp.DeprecatedException)14 SMTPException (lucee.runtime.net.mail.SMTPException)13 ArrayImpl (lucee.runtime.type.ArrayImpl)13 Query (lucee.runtime.type.Query)13