On Fri, 2017-02-17 at 09:38 -0800, Gary Gregory wrote:
> On Fri, Feb 17, 2017 at 2:43 AM, Oleg Kalnichevski <[email protected]>
> wrote:
>
...
> > Gary
> >
> > It should be quite easy to plug in a custom protocol interceptor
> > that
> > generates a user agent header with additional runtime details.
> > However,
> > I am not sure it would really make sense to change the format used
> > by
> > default. I hope you agree.
> >
>
> Sounds OK. Any hints as to where to allow this to be plugged in
> exactly?
>
> Gary
>
Something like that should do the job, should not it?
---
VersionInfo clientVersion =
VersionInfo.loadVersionInfo("org.apache.http.client",
Testing.class.getClassLoader());
VersionInfo coreVersion = VersionInfo.loadVersionInfo("org.apache.http",
Testing.class.getClassLoader());
String javaVersion = System.getProperty("java.version");
String agentInfo = String.format("HttpClient/%s HttpCore/%s Java/%s)",
clientVersion.getRelease(),
coreVersion.getRelease(),
javaVersion);
CloseableHttpClient client = HttpClientBuilder.create()
.setUserAgent(agentInfo)
.build();
---
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]