hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen J. Butler" <stephen.but...@gmail.com>
Subject Re: 回复: How to send request without urlencode?
Date Tue, 05 Aug 2014 06:37:44 GMT
I think that if you write your own HttpRequest subclass, and use the
client.execute(HttpHost, HttpRequest) overload, then you might get away
with what you're trying to do.

It's going to be a good amount of code copying through. Sure you can't just
fix the server to handle properly encoded URIs?


On Tue, Aug 5, 2014 at 1:24 AM, 风 <304611744@qq.com> wrote:

> 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";<xyqhello@gmail.com>;
> 发送时间: 2014年8月5日(星期二) 下午2:13
> 收件人: "HttpClient User Discussion"<httpclient-users@hc.apache.org>;
>
> 主题: 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, 风 <304611744@qq.com> 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!!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message