Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

httpclient's (3.1) URIUtil.encodeQuery() is gone in org.apache.httpcomponents (4.4.1), any substitute?

Tags:

httpclient

In my project code, there is a requirement to encode the URL. its currently using httpclient 3.1 jar and uses its method URIUtil.encodeQuery() to do the job. but we are upgrading the jar to the newer version, org.apache.httpcomponents 4.4.1.

where I couldn't find any exact substitute for encodeQuery method. it has been discussed in the post What happened to URIUtil.encodePath from commons-httpclient-3.1?.

But still I am looking for any good substitute for encodeQuery(), can anyone has suggestion.

Thanks

like image 237
shibashis dutta Avatar asked Aug 07 '26 04:08

shibashis dutta


1 Answers

In our project we use the URIBuilder class.

https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/utils/URIBuilder.html

The builder returns the standard java URI.

like image 103
Felix Novovic Avatar answered Aug 09 '26 19:08

Felix Novovic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!