本文整理匯總了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);
}
示例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;
}
示例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();
}