当前位置: 首页>>代码示例>>Java>>正文


Java DataLoader类代码示例

本文整理汇总了Java中eu.europa.esig.dss.client.http.DataLoader的典型用法代码示例。如果您正苦于以下问题:Java DataLoader类的具体用法?Java DataLoader怎么用?Java DataLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataLoader类属于eu.europa.esig.dss.client.http包,在下文中一共展示了DataLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
@Test
public void test() throws InterruptedException, ExecutionException {

	ExecutorService executor = Executors.newFixedThreadPool(20);

	CommonCertificateVerifier certificateVerifier = new CommonCertificateVerifier();
	DataLoader dataLoader = new NativeHTTPDataLoader();
	certificateVerifier.setDataLoader(dataLoader);

	List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>();

	for (int i = 0; i < 200; i++) {
		futures.add(executor.submit(new TestConcurrent(certificateVerifier)));
	}

	for (Future<Boolean> future : futures) {
		assertTrue(future.get());
	}

	executor.shutdown();
}
 
开发者ID:esig,项目名称:dss,代码行数:22,代码来源:ConcurrentValidationTest.java

示例2: tslValidationJob

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
@Bean
public TSLValidationJob tslValidationJob(DataLoader dataLoader, TSLRepository tslRepository, KeyStoreCertificateSource ojContentKeyStore) {
	TSLValidationJob validationJob = new TSLValidationJob();
	validationJob.setDataLoader(dataLoader);
	validationJob.setRepository(tslRepository);
	validationJob.setLotlUrl(lotlUrl);
	validationJob.setLotlRootSchemeInfoUri(lotlRootSchemeInfoUri);
	validationJob.setLotlCode(lotlCountryCode);
	validationJob.setOjUrl(ojUrl);
	validationJob.setOjContentKeyStore(ojContentKeyStore);
	validationJob.setCheckLOTLSignature(true);
	validationJob.setCheckTSLSignatures(true);
	return validationJob;
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:15,代码来源:DSSBeanConfig.java

示例3: findCrl

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
@Override
public CRLToken findCrl(final CertificateToken certificateToken) throws DSSException {

	if (certificateToken == null) {
		return null;
	}
	final CertificateToken issuerToken = certificateToken.getIssuerToken();
	if (issuerToken == null) {
		return null;
	}
	final List<String> crlUrls = DSSASN1Utils.getCrlUrls(certificateToken);
	LOG.info("CRL's URL for " + certificateToken.getAbbreviation() + " : " + crlUrls);
	if (Utils.isCollectionEmpty(crlUrls)) {
		return null;
	}

	prioritize(crlUrls);
	final DataLoader.DataAndUrl dataAndUrl = downloadCrl(crlUrls);
	if (dataAndUrl == null) {
		return null;
	}

	try (ByteArrayInputStream bais = new ByteArrayInputStream(dataAndUrl.data)) {
		final CRLValidity crlValidity = CRLUtils.isValidCRL(bais, issuerToken);
		final CRLToken crlToken = new CRLToken(certificateToken, crlValidity);
		crlToken.setSourceURL(dataAndUrl.urlString);
		crlToken.setAvailable(true);
		return crlToken;
	} catch (Exception e) {
		LOG.warn("Unable to parse/validate the CRL (url:" + dataAndUrl.urlString + ") : " + e.getMessage(), e);
		return null;
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:34,代码来源:OnlineCRLSource.java

示例4: downloadCrl

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
/**
 * Download a CRL from any location with any protocol.
 *
 * @param downloadUrls
 *            the {@code List} of urls to be used to obtain the revocation data through the CRL canal.
 * @return {@code X509CRL} or null if it was not possible to download the CRL
 */
private DataLoader.DataAndUrl downloadCrl(final List<String> downloadUrls) {
	try {
		return dataLoader.get(downloadUrls);
	} catch (DSSException e) {
		LOG.warn("Unable to download CRL from URLs {}", downloadUrls, e);
		return null;
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:16,代码来源:OnlineCRLSource.java

示例5: CommonCertificateVerifier

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
/**
 * The constructor with key parameters.
 *
 * @param trustedCertSource
 *            the reference to the trusted certificate source.
 * @param crlSource
 *            contains the reference to the {@code OCSPSource}.
 * @param ocspSource
 *            contains the reference to the {@code CRLSource}.
 * @param dataLoader
 *            contains the reference to a data loader used to access AIA certificate source.
 */
public CommonCertificateVerifier(final CertificateSource trustedCertSource, final CRLSource crlSource, final OCSPSource ocspSource,
		final DataLoader dataLoader) {

	LOG.info("+ New CommonCertificateVerifier created with parameters.");
	this.trustedCertSource = trustedCertSource;
	this.crlSource = crlSource;
	this.ocspSource = ocspSource;
	this.dataLoader = dataLoader;
	if (dataLoader == null) {
		LOG.warn("DataLoader is null. It's required to access AIA certificate source");
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:25,代码来源:CommonCertificateVerifier.java

示例6: loadPotentialIssuerCertificates

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
/**
 * This method loads the potential issuer certificate(s) from the given locations (AIA).
 * 
 * @param cert
 *            certificate for which the issuer(s) should be loaded
 * @param loader
 *            the data loader to use
 * @return a list of potential issuers
 */
public static Collection<CertificateToken> loadPotentialIssuerCertificates(final CertificateToken cert, final DataLoader loader) {
	List<String> urls = DSSASN1Utils.getCAAccessLocations(cert);

	if (Utils.isCollectionEmpty(urls)) {
		LOG.info("There is no AIA extension for certificate download.");
		return Collections.emptyList();
	}
	if (loader == null) {
		LOG.warn("There is no DataLoader defined to load Certificates from AIA extension (urls : {})", urls);
		return Collections.emptyList();
	}

	for (String url : urls) {
		LOG.debug("Loading certificate(s) from {}", url);
		byte[] bytes = loader.get(url);
		if (Utils.isArrayNotEmpty(bytes)) {
			LOG.debug("Base64 content : {}", Utils.toBase64(bytes));
			try (InputStream is = new ByteArrayInputStream(bytes)) {
				return loadCertificates(is);
			} catch (Exception e) {
				LOG.warn("Unable to parse certificate(s) from AIA (url: {}) : {}", url, e.getMessage());
			}
		} else {
			LOG.warn("Empty content from {}.", url);
		}
	}

	return Collections.emptyList();
}
 
开发者ID:esig,项目名称:dss,代码行数:39,代码来源:DSSUtils.java

示例7: getFileCacheDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
private DataLoader getFileCacheDataLoader() {
	FileCacheDataLoader cacheDataLoader = new FileCacheDataLoader();
	CommonsDataLoader dataLoader = new CommonsDataLoader();
	dataLoader.setProxyConfig(getProxyConfig());
	cacheDataLoader.setDataLoader(dataLoader);
	cacheDataLoader.setFileCacheDirectory(new File("target"));
	cacheDataLoader.setCacheExpirationTime(3600000L);
	return cacheDataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:10,代码来源:PKIFactoryAccess.java

示例8: createDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
private DataLoader createDataLoader() {
  if (Protocol.isHttpUrl(configuration.getTslLocation())) {
    CachingDataLoader dataLoader = new CachingDataLoader(configuration);
    dataLoader.setTimeoutConnection(configuration.getConnectionTimeout());
    dataLoader.setTimeoutSocket(configuration.getSocketTimeout());
    dataLoader.setCacheExpirationTime(configuration.getTslCacheExpirationTime());
    dataLoader.setFileCacheDirectory(fileCacheDirectory);
    logger.debug("Using file cache directory for storing TSL: " + fileCacheDirectory);
    return dataLoader;
  } else {
    return new CommonsDataLoader();
  }
}
 
开发者ID:open-eid,项目名称:digidoc4j,代码行数:14,代码来源:TslLoader.java

示例9: FileCacheDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
public FileCacheDataLoader(DataLoader dataLoader) {
	this.dataLoader = dataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:4,代码来源:FileCacheDataLoader.java

示例10: getDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
public DataLoader getDataLoader() {
	return dataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:4,代码来源:FileCacheDataLoader.java

示例11: setDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
public void setDataLoader(DataLoader dataLoader) {
	this.dataLoader = dataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:4,代码来源:FileCacheDataLoader.java

示例12: getDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
@Override
public DataLoader getDataLoader() {
	return dataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:5,代码来源:CommonCertificateVerifier.java

示例13: setDataLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
@Override
public void setDataLoader(final DataLoader dataLoader) {
	this.dataLoader = dataLoader;
}
 
开发者ID:esig,项目名称:dss,代码行数:5,代码来源:CommonCertificateVerifier.java

示例14: TSLLoader

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
public TSLLoader(DataLoader dataLoader, String countryCode, String urlToLoad) {
	this.dataLoader = dataLoader;
	this.countryCode= countryCode;
	this.urlToLoad = urlToLoad;
}
 
开发者ID:esig,项目名称:dss,代码行数:6,代码来源:TSLLoader.java

示例15: getKeystoreContent

import eu.europa.esig.dss.client.http.DataLoader; //导入依赖的package包/类
private byte[] getKeystoreContent(String keystoreName) {
	DataLoader dataLoader = getFileCacheDataLoader();
	String keystoreUrl = PKI_FACTORY_HOST + KEYSTORE_ROOT_PATH + keystoreName;
	return dataLoader.get(keystoreUrl);
}
 
开发者ID:esig,项目名称:dss,代码行数:6,代码来源:PKIFactoryAccess.java


注:本文中的eu.europa.esig.dss.client.http.DataLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。