Java Code Examples for org.apache.tomcat.util.file.ConfigFileLoader

The following examples show how to use org.apache.tomcat.util.file.ConfigFileLoader. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Tomcat8-Source-Read   Source File: SSLUtilBase.java    License: MIT License 6 votes vote down vote up
/**
 * Load the collection of CRLs.
 * @param crlf The path to the CRL file.
 * @return the CRLs collection
 * @throws IOException Error reading CRL file
 * @throws CRLException CRL error
 * @throws CertificateException Error processing certificate
 */
protected Collection<? extends CRL> getCRLs(String crlf)
    throws IOException, CRLException, CertificateException {

    Collection<? extends CRL> crls = null;
    try {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        try (InputStream is = ConfigFileLoader.getInputStream(crlf)) {
            crls = cf.generateCRLs(is);
        }
    } catch(IOException iex) {
        throw iex;
    } catch(CRLException crle) {
        throw crle;
    } catch(CertificateException ce) {
        throw ce;
    }
    return crls;
}
 
Example 2
Source Project: Tomcat8-Source-Read   Source File: MemoryRealm.java    License: MIT License 5 votes vote down vote up
/**
 * Prepare for the beginning of active use of the public methods of this
 * component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected void startInternal() throws LifecycleException {
    String pathName = getPathname();
    try (InputStream is = ConfigFileLoader.getInputStream(pathName)) {
        // Load the contents of the database file
        if (log.isDebugEnabled()) {
            log.debug(sm.getString("memoryRealm.loadPath", pathName));
        }

        Digester digester = getDigester();
        try {
            synchronized (digester) {
                digester.push(this);
                digester.parse(is);
            }
        } catch (Exception e) {
            throw new LifecycleException(sm.getString("memoryRealm.readXml"), e);
        } finally {
            digester.reset();
        }
    } catch (IOException ioe) {
        throw new LifecycleException(sm.getString("memoryRealm.loadExist", pathName), ioe);
    }

    super.startInternal();
}
 
Example 3
Source Project: Tomcat7.0.67   Source File: JSSESocketFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Load the collection of CRLs.
 *
 */
protected Collection<? extends CRL> getCRLs(String crlf)
    throws IOException, CRLException, CertificateException {

    Collection<? extends CRL> crls = null;
    InputStream is = null;
    try {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        is = ConfigFileLoader.getInputStream(crlf);
        crls = cf.generateCRLs(is);
    } catch(IOException iex) {
        throw iex;
    } catch(CRLException crle) {
        throw crle;
    } catch(CertificateException ce) {
        throw ce;
    } finally {
        if(is != null) {
            try{
                is.close();
            } catch(Exception ex) {
                // Ignore
            }
        }
    }
    return crls;
}
 
Example 4
Source Project: tomcatsrc   Source File: JSSESocketFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Load the collection of CRLs.
 *
 */
protected Collection<? extends CRL> getCRLs(String crlf)
    throws IOException, CRLException, CertificateException {

    Collection<? extends CRL> crls = null;
    InputStream is = null;
    try {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        is = ConfigFileLoader.getInputStream(crlf);
        crls = cf.generateCRLs(is);
    } catch(IOException iex) {
        throw iex;
    } catch(CRLException crle) {
        throw crle;
    } catch(CertificateException ce) {
        throw ce;
    } finally {
        if(is != null) {
            try{
                is.close();
            } catch(Exception ex) {
                // Ignore
            }
        }
    }
    return crls;
}