我的以下 WebClient 可以正常使用 Internet 连接,但不能通过我们的代理连接。
WebClient webClient = WebClient.builder()
.baseUrl("https://targetsite.com")
.build();
webClient.post()
.uri("/service/serviceName")
.body(BodyInserters.fromObject(reqData))
.retrieve()
.bodyToMono(WebServiceResponse.class)
Run Code Online (Sandbox Code Playgroud)
事件虽然,同一个客户端通过代理工作,如果我如下设置它,
HttpClient httpClient = HttpClient.create()
.tcpConfiguration(tcpClient -> tcpClient
.proxy(proxy -> proxy
.type(ProxyProvider.Proxy.HTTP)
.host("ourproxy.com")
.port(8080)));
ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
WebClient webClient = WebClient.builder()
.clientConnector(connector)
.baseUrl("https://targetsite.com")
.build();
webClient.post()
.uri("/service/serviceName")
.body(BodyInserters.fromObject(reqData))
.retrieve()
.bodyToMono(WebServiceResponse.class)
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用System.setProperty("http.proxyHost","ourproxy.com");
System.setProperty("http.proxyPort","8080");
或 JVM 运行时参数设置相同的代理详细信息-Dhttp.proxyHost=ourproxy.com -Dhttp.proxyPort=8080
WebClient webClient = WebClient.builder()
.baseUrl("https://targetsite.com")
.build();
System.setProperty("http.proxyHost", "ourproxy.com");
System.setProperty("http.proxyPort", "8080");
webClient.post()
.uri("/service/serviceName")
.body(BodyInserters.fromObject(reqData))
.retrieve()
.bodyToMono(WebServiceResponse.class)
Run Code Online (Sandbox Code Playgroud)
调用因 UnknownHostException 而失败,例如,
[04/11/2019 12:32:43.031 IST] DEBUG [reactor-http-epoll-3] [PooledConnectionProvider:254] - …Run Code Online (Sandbox Code Playgroud) 我有JTable table15 行和 5 列,当我调用如下函数时,我想更改第三列/第二行单元格的背景颜色
更改BgColor(行,列);
这可能吗?