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


Java ClientConfig类代码示例

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


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

示例1: Scim2Provisioner

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
public Scim2Provisioner(final String target, final String oauthToken,
                        final String username, final String password,
                        final Scim2PrincipalAttributeMapper mapper) {
    final ClientConfig config = new ClientConfig();
    final ApacheConnectorProvider connectorProvider = new ApacheConnectorProvider();
    config.connectorProvider(connectorProvider);
    final Client client = ClientBuilder.newClient(config);
    
    if (StringUtils.isNotBlank(oauthToken)) {
        client.register(OAuth2ClientSupport.feature(oauthToken));
    }
    if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
        client.register(HttpAuthenticationFeature.basic(username, password));
    }
    
    final WebTarget webTarget = client.target(target);
    this.scimService = new ScimService(webTarget);
    this.mapper = mapper;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:20,代码来源:Scim2Provisioner.java

示例2: ParaClient

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
/**
 * Default constructor.
 * @param accessKey app access key
 * @param secretKey app secret key
 */
public ParaClient(String accessKey, String secretKey) {
	this.accessKey = accessKey;
	this.secretKey = secretKey;
	if (StringUtils.length(secretKey) < 6) {
		logger.warn("Secret key appears to be invalid. Make sure you call 'signIn()' first.");
	}
	ClientConfig clientConfig = new ClientConfig();
	clientConfig.register(GenericExceptionMapper.class);
	clientConfig.register(new JacksonJsonProvider(ParaObjectUtils.getJsonMapper()));
	clientConfig.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
	SSLContext sslContext = SslConfigurator.newInstance().securityProtocol("TLSv1").createSSLContext();
	System.setProperty("https.protocols", "TLSv1");
	apiClient = ClientBuilder.newBuilder().
			sslContext(sslContext).
			withConfig(clientConfig).build();
}
 
开发者ID:Erudika,项目名称:para,代码行数:22,代码来源:ParaClient.java

示例3: dumpSwitches

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
/**
 * Returns Switches through Topology-Engine-Rest service.
 *
 * @return The JSON document of all flows
 */
public static List<SwitchInfoData> dumpSwitches() throws Exception {
    System.out.println("\n==> Topology-Engine Dump Switches");

    Client client = ClientBuilder.newClient(new ClientConfig());

    Response response = client
            .target(topologyEndpoint)
            .path("/api/v1/topology/switches")
            .request()
            .header(HttpHeaders.AUTHORIZATION, authHeaderValue)
            .get();

    System.out.println(String.format("===> Response = %s", response.toString()));

    List<SwitchInfoData> switches = new ObjectMapper().readValue(
            response.readEntity(String.class), new TypeReference<List<SwitchInfoData>>() {});
    System.out.println(String.format("====> Data = %s", switches));

    return switches;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:26,代码来源:SwitchesUtils.java

示例4: createClientFromConfig

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private static Client createClientFromConfig(NiFiRegistryClientConfig registryClientConfig) {

        final ClientConfig clientConfig = new ClientConfig();
        clientConfig.register(jacksonJaxbJsonProvider());

        final ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);

        final SSLContext sslContext = registryClientConfig.getSslContext();
        if (sslContext != null) {
            clientBuilder.sslContext(sslContext);
        }

        final HostnameVerifier hostnameVerifier = registryClientConfig.getHostnameVerifier();
        if (hostnameVerifier != null) {
            clientBuilder.hostnameVerifier(hostnameVerifier);
        }

        return clientBuilder.build();
    }
 
开发者ID:apache,项目名称:nifi-registry,代码行数:20,代码来源:IntegrationTestBase.java

示例5: getNumberOfDatapoints

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private List<Metric> getNumberOfDatapoints() throws Throwable {
    System.out.println("\n==> OpenTSDB Metrics request");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());

    Response response = client
            .target(opentsdbEndpoint)
            .path("/api/query")
            .queryParam("start", "24h-ago")
            .queryParam("m", "sum:pen.switch.tx-bytes")
            .queryParam("timezone", "Australia/Melbourne")
            .request().get();

    System.out.println(String.format("===> Response = %s", response));
    System.out.println(String.format("===> OpenTSDB Metrics Time: %,.3f", getTimeDuration(current)));

    List<Metric> metrics = new ObjectMapper().readValue(
            response.readEntity(String.class), new TypeReference<List<Metric>>() {});

    System.out.println(String.format("====> Metrics = %s", metrics));

    return metrics;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:25,代码来源:StatisticsBasicTest.java

示例6: trafficIsOk

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean trafficIsOk(boolean expectedResult) throws Throwable {
    if (isTrafficTestsEnabled()) {
        System.out.println("=====> Send traffic");

        long current = System.currentTimeMillis();
        Client client = ClientBuilder.newClient(new ClientConfig());
        Response result = client
                .target(trafficEndpoint)
                .path("/checkflowtraffic")
                .queryParam("srcswitch", "s1")
                .queryParam("dstswitch", "s8")
                .queryParam("srcport", "1")
                .queryParam("dstport", "1")
                .queryParam("srcvlan", "1000")
                .queryParam("dstvlan", "1000")
                .request()
                .get();

        System.out.println(String.format("======> Response = %s", result.toString()));
        System.out.println(String.format("======> Send traffic Time: %,.3f", getTimeDuration(current)));

        return result.getStatus() == 200;
    } else {
        return expectedResult;
    }
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:27,代码来源:FlowFFRTest.java

示例7: disconnectSwitch

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean disconnectSwitch(String switchName) throws Exception {
    System.out.println("\n==> Disconnect Switch");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/knockoutswitch")
            .queryParam("switch", switchName)
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Disconnect Switch Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:18,代码来源:FlowFFRTest.java

示例8: connectSwitch

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean connectSwitch(String switchName, String controller) throws Exception {
    System.out.println("\n==> Connect Switch");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/reviveswitch")
            .queryParam("switch", switchName)
            .queryParam("controller", "tcp:" + controller + ":6653")
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Connect Switch Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:FlowFFRTest.java

示例9: islDiscovered

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean islDiscovered(String switchName, String portNo) throws Throwable {
    System.out.println("\n==> Set ISL Discovered");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/restorelink")
            .queryParam("switch", switchName)
            .queryParam("port", portNo)
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Set ISL Discovered Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:FlowFFRTest.java

示例10: portDown

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean portDown(String switchName, String portNo) throws Throwable {
    System.out.println("\n==> Set Port Down");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/port/down")
            .queryParam("switch", switchName)
            .queryParam("port", portNo)
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Set Port Down Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:FlowFFRTest.java

示例11: portUp

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
private boolean portUp(String switchName, String portNo) throws Throwable {
    System.out.println("\n==> Set Port Up");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/port/up")
            .queryParam("switch", switchName)
            .queryParam("port", portNo)
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Set Port Up Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:FlowFFRTest.java

示例12: sendMalformedLldpPacket

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
@When("^send malformed lldp packet$")
public void sendMalformedLldpPacket() throws Throwable {
        System.out.println("=====> Send malformed packet");

        long current = System.currentTimeMillis();
        Client client = ClientBuilder.newClient(new ClientConfig());
        Response result = client
                .target(trafficEndpoint)
                .path("/send_malformed_packet")
                .request()
                .post(null);
        System.out.println(String.format("======> Response = %s", result.toString()));
        System.out.println(String.format("======> Send malformed packet Time: %,.3f", getTimeDuration(current)));

    assertEquals(200, result.getStatus());

}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:18,代码来源:TopologyDiscoveryBasicTest.java

示例13: dumpLinks

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
/**
 * Returns links through Topology-Engine-Rest service.
 *
 * @return The JSON document of all flows
 */
public static List<IslInfoData> dumpLinks() throws Exception {
    System.out.println("\n==> Topology-Engine Dump Links");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());

    Response response = client
            .target(topologyEndpoint)
            .path("/api/v1/topology/links")
            .request()
            .header(HttpHeaders.AUTHORIZATION, authHeaderValue)
            .get();

    System.out.println(String.format("===> Response = %s", response.toString()));
    System.out.println(String.format("===> Topology-Engine Dump Links Time: %,.3f", getTimeDuration(current)));

    List<IslInfoData> links = new ObjectMapper().readValue(
            response.readEntity(String.class), new TypeReference<List<IslInfoData>>() {});
    System.out.println(String.format("====> Data = %s", links));

    return links;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:28,代码来源:LinksUtils.java

示例14: islFail

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
public static boolean islFail(String switchName, String portNo) {
    System.out.println("\n==> Set ISL Discovery Failed");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(trafficEndpoint)
            .path("/cutlink")
            .queryParam("switch", switchName)
            .queryParam("port", portNo)
            .request()
            .post(Entity.json(""));

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Set ISL Discovery Failed Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:LinksUtils.java

示例15: DeleteMininetTopology

import org.glassfish.jersey.client.ClientConfig; //导入依赖的package包/类
public static boolean DeleteMininetTopology() {
    System.out.println("\n==> Delete Mininet Topology");

    long current = System.currentTimeMillis();
    Client client = ClientBuilder.newClient(new ClientConfig());
    Response result = client
            .target(mininetEndpoint)
            .path("/cleanup")
            .request(MediaType.APPLICATION_JSON)
            .post(null);

    System.out.println(String.format("===> Response = %s", result.toString()));
    System.out.println(String.format("===> Delete Mininet Topology Time: %,.3f", getTimeDuration(current)));

    return result.getStatus() == 200;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:17,代码来源:TopologyHelp.java


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