hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Log misleading for User-Agent
Date Sat, 17 Nov 2012 15:25:24 GMT
On Fri, 2012-11-16 at 21:19 -0500, Gary Gregory wrote:
> As a tangent I want to reduce this code pattern which is duplicated no less
> than six times:
> 
>         // determine the release version from packaged version info
>         final VersionInfo vi = VersionInfo.loadVersionInfo
>             ("org.apache.http.client",
> HttpClientBuilder.class.getClassLoader());
>         final String release = (vi != null) ?
>             vi.getRelease() : VersionInfo.UNAVAILABLE;
>         HttpProtocolParams.setUserAgent(params,
>                 "Apache-HttpClient/" + release + " (java 1.5)");
> 
> into a new method:
> 
>     setUserAgent(params, "Apache-HttpClient", "org.apache.http.client",
> HttpClientBuilder.class);
> 
>     public static void setUserAgent(HttpParams params, String name, String
> pkg, Class<?> cls) {
>         final VersionInfo vi = VersionInfo.loadVersionInfo(pkg,
> cls.getClassLoader());
>         final String release = (vi != null) ? vi.getRelease() :
> VersionInfo.UNAVAILABLE;
>         HttpProtocolParams.setUserAgent(params, name + "/" + release + "
> (java 1.5)");
>     }
> 
> The question is: where in Core should it go?
> 
> I see that HttpProtocolParams is deprecated, so it cannot go in there.
> 
> So... where?
> 
> Gary
> 

Gary

HttpClient trunk is in a state of flux right now. But please bear with
me a little while longer. I think HttpCore 4.3-alpha1 should be ready
quite soon. Once HttpClient trunk picks up new APIs from HttpCore 4.3 a
lot of things should become clearer (or so I would like to hope).

---
I think this particular bit belongs to HttpClientBuilder and it should
only be used once. Another place for it might be HttpClientUtils.

I am also in favor of option 3. Besides, we might even have something
that combine option 2 and 3

3) User-Agent: Apache-HttpClient/4.2.1 (Java 1.5 compatible;
Java/1.6.0_35)

---
I double-checked JIRA settings once again and found out that I had had
used an older (or different) account of yours. Could you please try
again and let me know of the name of the account you have been using if
it still does not work?  

Oleg

> On Fri, Nov 16, 2012 at 9:12 PM, Jon Moore <jonm@apache.org> wrote:
> 
> > On Fri, Nov 16, 2012 at 8:42 PM, Gary Gregory <garydgregory@gmail.com>
> > wrote:
> > > 1) do nothing
> > > 2) User-Agent: Apache-HttpClient/4.2.1 (Java 1.5+ min)
> > > 3) User-Agent: Apache-HttpClient/4.2.1 (Java/1.6.0_35)
> > >
> > > 3 is in the spirit of the JRE's HttpURLConnection FWIW.
> >
> > If you're collecting votes, I'd vote for #3, but I have no objections
> > to any of these--all are reasonable.
> >
> > Jon
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message