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

The following examples show how to use org.apache.tomcat.util.file.ConfigFileLoader. 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 File: SSLUtilBase.java    From Tomcat8-Source-Read with 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 File: MemoryRealm.java    From Tomcat8-Source-Read with 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 File: JSSESocketFactory.java    From Tomcat7.0.67 with 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 File: JSSESocketFactory.java    From tomcatsrc with 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;
}