Hi, I am using below codes to write a https client using Jetty 9.4.7. I use the FQDN kind of url https://www.eclipse.org/jetty/ to do newRequest, I checked the jetty code, and got that Jetty will use this url to create socket connection.
We often have a requirement that the application need balance the IP resolved from FQDN and record the IP which can't successfully be connected, and not depend on DNS server to do it. i.e., our application will do DNS/SRV lookup on www.eclipse.org in below example, there will be several IPs retrieved, our application will select one IP (e.g., 198.41.30.198 ) according to some rule, and then use this IP to build the socket, and the request still use FQDN kind of url https://www.eclipse.org/jetty/ as the request url, use FQDN www.eclipse.org:443<http://www.eclipse.org:443> as the Host header. I can't find the way to specify the remote InetSocketAddress with IP so as to build socket connection, could you please help with that? HttpClient client = new HttpClient(clientTLSFactory); InetSocketAddress localAddress = new InetSocketAddress("10.9.101.100", 0); //local host IP client.setBindAddress(localAddress); Request httpsreq httpsreq = client.newRequest("https://www.eclipse.org/jetty/") .method(org.eclipse.jetty.http.HttpMethod.POST); //Here I want to specify the IP for this request, to build the socket connection. //e.g., //httpsreq.setRemoteInetAddress("198.41.30.198"); httpsreq.header("Host", "www.eclipse.org:443"); httpsreq.header(otherheaderName, headerValue); httpsreq.content(new BytesContentProvider("Hello Jetty"), "application/json"); httpsreq.send(new Response.Listener.Adapter() { ...... @Override public void onFailure(Response response, Throwable failure) { ... } @Override public void onSuccess(Response response) { ... } ...... } Regards, William
_______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
