httpclient httpget doesn't accept square brackets
I'm using HttpGet to return a file, and HttpGet doesn't allow the argument to be a URL, it has to be a URL, however the problem I face is that I have* to use httpclient, and I need to be able to put special characters in the URI/URL eg square brackets so:
http://127.0.0.1:8080/exists/rest/db/catalog?_query=//album[contains(title,"")]
What can I do?
在使用URLEncoder.encode(yourQueryString,"UTF-8");
传递给HttpGet之前, URLEncoder.encode(yourQueryString,"UTF-8");
包含特殊字符的url部分URLEncoder.encode(yourQueryString,"UTF-8");
上一篇: 如何编码春季url中的方括号?