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


Java Client.property方法代码示例

本文整理汇总了Java中javax.ws.rs.client.Client.property方法的典型用法代码示例。如果您正苦于以下问题:Java Client.property方法的具体用法?Java Client.property怎么用?Java Client.property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.ws.rs.client.Client的用法示例。


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

示例1: RadioBrowser

import javax.ws.rs.client.Client; //导入方法依赖的package包/类
/** Custom constructor for mocked unit testing.
 * @param apiUrl the base URL of the API.
 * @param timeout the timeout in milliseconds for connecting
 *                and reading.
 * @param myUserAgent the user agent string to use.
 * */
RadioBrowser(final String apiUrl,
                     final int timeout,
                     final String myUserAgent) {
    if (timeout <= 0) {
        throw new IllegalArgumentException(
                "timeout must be > 0, but is "
                        + timeout);
    }
    this.userAgent = Objects.requireNonNull(myUserAgent,
            "User agent is null");
    Client client = ClientBuilder.newBuilder()
            .register(JacksonFeature.class)
            .build();
    client.property(ClientProperties.CONNECT_TIMEOUT, timeout);
    client.property(ClientProperties.READ_TIMEOUT,    timeout);
    webTarget = client.target(apiUrl);
}
 
开发者ID:sfuhrm,项目名称:radiobrowser4j,代码行数:24,代码来源:RadioBrowser.java

示例2: getInvocationBuilder

import javax.ws.rs.client.Client; //导入方法依赖的package包/类
protected Builder getInvocationBuilder(String url, Map<String, String> queryParameters) {
		ClientConfig clientConfig = new ClientConfig();
		if (getProxyAddress() != null) {
			clientConfig.connectorProvider(new ApacheConnectorProvider());
			clientConfig.property(ClientProperties.PROXY_URI, getProxyAddress());
		}
		Client client = ClientBuilder.newClient(clientConfig);
		client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
		WebTarget webTarget = client.target(url);

		if (queryParameters != null) {
			for (Map.Entry<String, String> queryParameter: queryParameters.entrySet())
//				webTarget = webTarget.queryParam(queryParameter.getKey(), queryParameter.getValue().replace("_", "_1").replace("%",  "_0"));
				webTarget = webTarget.queryParam(queryParameter.getKey(), queryParameter.getValue());
		}

		
		return webTarget.request(MediaType.APPLICATION_JSON).accept("application/ld+json").header("Authorization", getCloudTokenValue());
	}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:20,代码来源:OEClientReadOnly.java

示例3: init

import javax.ws.rs.client.Client; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    Client client = ClientBuilder.newClient();
    client.property("http.connection.timeout", this.connectionTimeout);
    System.out.println(connectionTimeout);
    System.out.println(readTimeout);
    client.property("http.receive.timeout", this.readTimeout);
    this.webTarget = client.target(ADDITION_URI);
}
 
开发者ID:h2mch,项目名称:poi,代码行数:10,代码来源:ExampleService.java


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