On Fri, 2022-10-28 at 17:28 +0200, Francisco A. Lozano wrote: > Hi, > > I'm trying to port a tweaked ConnectionKeepAliveStrategy which > applies a > custom behaviour depending on the target host. > > With 4.5.x I followed the example in: > https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/connmgmt.html > > and obtained the target host with > > HttpHost target = (HttpHost) > context.getAttribute(HttpCoreContext.HTTP_TARGET_HOST); > > but this constant is not available anymore in the HttpCoreContext. > > What is the right way to obtain the target host from the HttpContext > when > moving to http client 5? I was looking at CONNECTION_ENDPOINT and the > remoteAddress of EndpointDetails, but it's not equivalent to a target > hostname. > > Francisco A. Lozano
In 5.x one can get those details directly from the request object. See HttpRequest#getScheme and HttpRequest#getAuthority. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org