hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Since URIBuilder.setQuery is deprecated shouldn't clearQuery also be deprecated?
Date Thu, 31 Oct 2013 09:58:03 GMT
On Wed, 2013-10-30 at 18:00 +0000, Jacob R Quant wrote:
> It seems like the preferred way to manipulate the query string associated with a URI
when using org.apache.http.client.utils.URIBuilder is using the  rather than the setQuery
and removeQuery methods. However, while the setQuery method is deprecated the removeQuery
method is not. Is this an oversight or is there a specific reason for this? I would like to
understand their intended uses better.
> BTW, I posted a question about this at StackOverflow.com as well, but I am not sure if
members of this list monitor those or not.
> http://stackoverflow.com/questions/19668899/what-is-the-difference-between-removequery-and-clearparameters-in-org-ap


The reason for deprecation of the #setQuery method was its inconsistency
of its contract with all other methods of the class. #setQuery expected
input to be URL encoded whereas all other methods expect unescaped
input. The choice was between changing the contract of the method and by
doing so breaking pretty much every single application reliant on
URIBuilder or method deprecation in favor of another method with
slightly less intuitive name. So, one should be using [set|clear|
add]Parameter[s] methods to work with query parameters and the
#setCustomQueury method to set custom queries.

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