Yes, if get an HttpGet with a string " http://xx.com/?a=<p>b</p>", a IllegalArgumentException will be thrown. My code is: try { URL url = new URL("http://xx.com/?a=<p>b</p>"); URI uri = new URI(url.getProtocol(), null, url.getHost(), url.getPort(), url.getPath(), url.getQuery(), null); HttpGet httpGet = new HttpGet(uri); } catch(Exception e) { e.printStackTrace(); }
I have a special requirement, so need to send request without urlencode. ------------------ 原始邮件 ------------------ 发件人: "Qinger";<[email protected]>; 发送时间: 2014年8月5日(星期二) 下午2:13 收件人: "HttpClient User Discussion"<[email protected]>; 主题: Re: How to send request without urlencode? Does it really matter? We should urlencode the params so that the HttpClient will execute the request normally. If you get an HttpGet with a string " http://xx.com/?a=<p>b</p>", a IllegalArgumentException will be thrown. ----------------------------------------------------------------------------- 为什么要不经过UrlEncode处理的请求呢。正常的程序就是应该将请求字符串UrlEncode之后,发送给服务器。 On Tue, Aug 5, 2014 at 1:16 PM, 风 <[email protected]> wrote: > I want to send the request with the query without urlencode. For example: > > > I want to request the url: http://xx.com/?a=<p>b</p> > I do want to urlencode the char: < > / > But when i use HttpClient, it will make a request to : > http://xx.com/?a=%3cp%3eb%3c%2fp%3e > > > How can i send a request without urlencode? thanks very much!!
