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 <[email protected]> wrote:
>
> > On Fri, Nov 16, 2012 at 8:42 PM, Gary Gregory <[email protected]>
> > 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: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]