On Sat, Feb 18, 2017 at 1:56 AM, Oleg Kalnichevski <[email protected]> wrote:

> 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();
> ---
>

Perfect! Thank you Oleg. In my version I also added the "java.vendor"
property so I can see:

2017-02-20 15:10:36,390 DEBUG [main][org.apache.http.headers]
http-outgoing-0 >> User-Agent: HttpClient/4.5.3 HttpCore/4.4.6 Java/Oracle
Corporation 1.7.0_80)

Thank you!

Gary


> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
E-Mail: [email protected] | [email protected]
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to