本文整理汇总了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();
}