當前位置: 首頁>>代碼示例>>Java>>正文


Java ClientEndpointConfig.Configurator方法代碼示例

本文整理匯總了Java中javax.websocket.ClientEndpointConfig.Configurator方法的典型用法代碼示例。如果您正苦於以下問題:Java ClientEndpointConfig.Configurator方法的具體用法?Java ClientEndpointConfig.Configurator怎麽用?Java ClientEndpointConfig.Configurator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.websocket.ClientEndpointConfig的用法示例。


在下文中一共展示了ClientEndpointConfig.Configurator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: streamLoggregatorLogs

import javax.websocket.ClientEndpointConfig; //導入方法依賴的package包/類
private StreamingLogToken streamLoggregatorLogs(String appName, ApplicationLogListener listener, boolean recent) {
    ClientEndpointConfig.Configurator configurator = new ClientEndpointConfig.Configurator() {
        @Override
        public void beforeRequest(Map<String, List<String>> headers) {
            String authorizationHeader = oauthClient.getAuthorizationHeader();
            if (authorizationHeader != null) {
                headers.put(AUTHORIZATION_HEADER_KEY, Arrays.asList(authorizationHeader));
            }
        }
    };

    String endpoint = getInfo().getLoggregatorEndpoint();
    String mode = recent ? "dump" : "tail";
    UUID appId = getAppId(appName);
    return loggregatorClient.connectToLoggregator(endpoint, mode, appId, listener, configurator);
}
 
開發者ID:SAP,項目名稱:cf-java-client-sap,代碼行數:17,代碼來源:CloudControllerClientImpl.java

示例2: buildClientConfig

import javax.websocket.ClientEndpointConfig; //導入方法依賴的package包/類
private ClientEndpointConfig buildClientConfig(ClientEndpointConfig.Configurator configurator) {
    ClientEndpointConfig config = ClientEndpointConfig.Builder.create().configurator(configurator).build();

    if (trustSelfSignedCerts) {
        SSLContext sslContext = buildSslContext();
        Map<String, Object> userProperties = config.getUserProperties();
        userProperties.put(WsWebSocketContainer.SSL_CONTEXT_PROPERTY, sslContext);
    }

    return config;
}
 
開發者ID:SAP,項目名稱:cf-java-client-sap,代碼行數:12,代碼來源:LoggregatorClient.java

示例3: createClientEndpointConfigWithJsession

import javax.websocket.ClientEndpointConfig; //導入方法依賴的package包/類
private ClientEndpointConfig createClientEndpointConfigWithJsession(final String jsession, final String userpwd) {
	ClientEndpointConfig.Configurator configurator = new ClientEndpointConfig.Configurator() {
		@Override
		public void beforeRequest(Map<String, List<String>> headers) {
			if (null != jsession) {
				headers.put("Cookie", Arrays.asList("JSESSIONID=" + jsession));
			} 
			headers.put("Authorization", Arrays.asList("Basic " + DatatypeConverter.printBase64Binary(userpwd.getBytes())));
		}
	};
	return ClientEndpointConfig.Builder.create().configurator(configurator).build();
}
 
開發者ID:ocelotds,項目名稱:ocelot,代碼行數:13,代碼來源:AbstractOcelotTest.java


注:本文中的javax.websocket.ClientEndpointConfig.Configurator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。