【问题标题】:Armeria WebClient request with connection factory and Req header带有连接工厂和 Req 标头的 Armeria WebClient 请求
【发布时间】:2020-07-18 03:25:56
【问题描述】:

我一直在尝试使用 armeria WebClient 建立 https 连接,因为未指定连接工厂,所以我收到了 javax.net.ssl.SSLHandshakeException 任何人都可以提供相关示例吗? 谢谢

【问题讨论】:

    标签: spring-boot armeria


    【解决方案1】:
      RequestHeaders header = RequestHeaders.of(HttpMethod.GET, endpoint, HttpHeaderNames.COOKIE,
                cookieHeader);
        WebClient.of(clientFactory(), hosturl)
        .execute(header)
        .aggregate()
        .whenCompleteAsync((resp,cause)->{
            if(cause != null) {
               //TODO
            }
            else if(resp.status()==HttpStatus.OK) {
                //TODO
            }
            else
            {
                //TODO
            }
    
    
        });
    
    
    
    
     public static ClientFactory clientFactory() {
    
        return ClientFactory.builder().sslContextCustomizer(b -> b.trustManager(InsecureTrustManagerFactory.INSTANCE))
                .idleTimeout(Duration.ZERO).build();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-18
      • 1970-01-01
      • 2020-12-23
      • 2011-12-11
      • 2019-07-14
      • 1970-01-01
      • 2011-11-27
      相关资源
      最近更新 更多