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


Java HTTPSProperties类代码示例

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


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

示例1: hostIgnoringClient

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
/**
 * Create a client which trust any HTTPS server
 * 
 * @return
 */
public static Client hostIgnoringClient() {
    try {
        SSLContext sslcontext = SSLContext.getInstance("TLS");
        sslcontext.init(null, null, null);
        DefaultClientConfig config = new DefaultClientConfig();
        Map<String, Object> properties = config.getProperties();
        HTTPSProperties httpsProperties = new HTTPSProperties(new HostnameVerifier() {
            @Override
            public boolean verify(String s, SSLSession sslSession) {
                return true;
            }
        }, sslcontext);
        properties.put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpsProperties);
        // config.getClasses().add( JacksonJsonProvider.class );
        return Client.create(config);
    } catch (KeyManagementException | NoSuchAlgorithmException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:25,代码来源:RestUtilTest.java

示例2: initSSL

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
private void initSSL(ClientConfig config) throws Exception {
	
	log("* Init SSL connection ...");		
	sslContext = SSLContext.getInstance("SSL");
	tm = createTrustManager();
	sslContext.init(null, new TrustManager[] {tm}, null);
	config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
			new HTTPSProperties(createHostnameVerifier(), sslContext));		
	
	SSLSocketFactory factory = sslContext.getSocketFactory();

	URL url = new URL(server);
	String host = url.getHost();
	int port = url.getPort();
	log("  -> Opening connection to " + host + ":" + port + "...");
	SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
	socket.setSoTimeout(10000);

	log("  -> Starting SSL handshake...");
	socket.startHandshake();
	socket.close();		
	log("  -> No errors, certificate is already trusted");		
}
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:24,代码来源:WebServiceClient.java

示例3: getClientConfig

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
private ClientConfig getClientConfig(boolean tlsEnabled, boolean hostnameVerificationEnabled)
  throws NoSuchAlgorithmException {
  ClientConfig clientConfig = new DefaultClientConfig();
  if (tlsEnabled) {
    HostnameVerifier verifier = hostnameVerificationEnabled ?
      HttpsURLConnection.getDefaultHostnameVerifier() : ALLOW_ALL_HOSTNAME_VERIFIER;
    clientConfig.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
      new HTTPSProperties(verifier, SSLContext.getDefault()));
  }
  return clientConfig;
}
 
开发者ID:cloudera,项目名称:director-sdk,代码行数:12,代码来源:ApiClient.java

示例4: getOperationsList

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
/**
 * Fetches the operations list (list of changes) from the remote repository.
 * 
 * @param remoteRegistry
 *            harvested registry.
 * @return list of operations fetched from the registry.
 * @throws UniformInterfaceException
 *             if remote repository's reply have unexpected format.
 */
private Operations getOperationsList(RemoteRegistry remoteRegistry)
        throws UniformInterfaceException {
    ClientConfig config = new DefaultClientConfig();
    config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
        new HTTPSProperties(getHostnameVerifier(), getSSLContext()));
    Client client = Client.create(config);
    client.addFilter(new HTTPBasicAuthFilter("test", "test"));
    WebResource service = client.resource(getURI(remoteRegistry));
    service.addFilter(new HTTPBasicAuthFilter("test", "test"));
    if (remoteRegistry.getLatestHarvestDate() != null) {
        service = service.queryParam("from", remoteRegistry.getLatestHarvestDate().toString());
    }
    return service.accept(MediaType.APPLICATION_XML).get(Operations.class);
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:24,代码来源:RegistryHarvesterBean.java

示例5: initClient

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
private Client initClient(Context context) {
    final Boolean skipSsl = context.getBoolean(CONF_SKIP_SSL, Boolean.FALSE);
    if (skipSsl) {
        ClientConfig config = new DefaultClientConfig(); // SSL configuration
        // SSL configuration
        config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
                new com.sun.jersey.client.urlconnection.HTTPSProperties(getHostnameVerifier(), getSSLContext()));
        return Client.create(config);
    } else {
        return new Client();
    }
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:13,代码来源:RestSource.java

示例6: getClientConfig

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
@Override
protected ClientConfig getClientConfig() {
    ClientConfig clientConfig = super.getClientConfig();

    /* Adding HTTPS-specific properties to config */
    clientConfig.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, getHttpsProperties());

    return clientConfig;
}
 
开发者ID:anotheria,项目名称:moskito-central,代码行数:10,代码来源:RESTHttpsConnector.java

示例7: createClient

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
private static Client createClient() {
	ClientConfig config = new DefaultClientConfig();
	SSLContext context = Ssl.createContext();
	if (context != null) {
		config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
				new HTTPSProperties(HttpsURLConnection.getDefaultHostnameVerifier(), context));
	}
	Client client = Client.create(config);
	client.setChunkedEncodingSize(1024 * 100); // 100kb
	return client;
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:12,代码来源:WebRequests.java

示例8: getHttpsProperties

import com.sun.jersey.client.urlconnection.HTTPSProperties; //导入依赖的package包/类
private HTTPSProperties getHttpsProperties() {
    return new HTTPSProperties(getHostnameVerifier(), getSslContext());
}
 
开发者ID:anotheria,项目名称:moskito-central,代码行数:4,代码来源:RESTHttpsConnector.java


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