當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。