hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Javadocs inconsistency concerning [Basic]HttpResponse in HttpCore-4.3
Date Wed, 04 Sep 2013 09:41:06 GMT
On Tue, 2013-09-03 at 23:47 +0400, Dmitry Potapov wrote:
> Hello everyone,
> I'm a bit confused with some inconsistencies in javadocs concerning
> HttpResponse. Probably you can confirm that some of these inconsistencies are
> typos or bugs:
>   1. [Basic]HttpResponse: getLocale/setLocale is marked as deprecated:
>     "use org.apache.http.impl.DefaultHttpRequestFactory"
>     Is org.apache.http.impl.DefaultHttpResponseFactory implied here?

It is a typo. Naturally it should be DefaultHttpResponseFactory.
Corrected in SVN trunk:


>   2. HttpResponse: setStatusCode has the following note in the description:
>     "The reason phrase will be updated according to the new status code,
>     based on the current locale".
>     But in the BasicHttpResponse.setStatusCode implementation I see that
>     'reasonPhrase' is left untouched. My first desire was to add the following
>     line to this function (as it seems to be most elegant solution):
>     "this.reasonPhrase = getReason(code)"
>     but BasicHttpResponse.getReason is marked deprecated now, so this fix
>     doesn't seem to be acceptable.

#getReason and Locate related methods got deprecated as violating the
separation of concerns principle. HTTP message objects are meant to be
plain java beans containing no special processing or protocol logic.
Assembly of complex HTTP message objects should be done a responsibility
of factory classes.

> What is the correct way to set HttpResponse status code with reason phrase
> update in HttpCore 4.3?

For non-trivial cases it should be DefaultHttpResponseFactory or a
custom implementation of the HttpResponseFactory interface.

Hope this helps


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

View raw message