httpclient httpget不接受方括号

我使用HttpGet来返回文件,HttpGet不允许参数是一个URL,它必须是一个URL,但是我面对的问题是我有*使用httpclient,我需要能够将特殊字符放在URI / URL中,例如方括号如下:

http://127.0.0.1:8080/exists/rest/db/catalog?_query=//album[contains(title,"")]

我能做什么?


在使用URLEncoder.encode(yourQueryString,"UTF-8");传递给HttpGet之前, URLEncoder.encode(yourQueryString,"UTF-8");包含特殊字符的url部分URLEncoder.encode(yourQueryString,"UTF-8");

链接地址: http://www.djcxy.com/p/70167.html

上一篇: httpclient httpget doesn't accept square brackets

下一篇: Upload File with brackets ([ & ]) in the name