EndPointConfigurator.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:Ka-Websocket 作者:
@Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {


    String url = endpointConfig.getUrl();
    if (endpointConfig.isDynamicAddressing()) {
       // url = request.getRequestURI().substring(request.getContextPath().length());
    }
    ClientChannel clientChannel = endpointConfig.getClientChannelFor(url);

    String username = null;
    try {
        username = clientChannel.authenticate(endpointConfig.getAuthenticationProvider(), request);
    } catch (AuthenticationException e) {
       LOG.warn("Unauthorized access for " + request, e);  
       throw new SecurityException("Unauthorized access for " + request);
    }

    client = endpointConfig.getClientBuilder(clientChannel).get(request)
                                        .username(username)
                                        .url(url)
                                        .protocol(selectedProtocol, endpointConfig.getProtocolRepository())
                                        .build();



}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号