本文介绍了不能在Java / Apache的HttpClient的垂直/管棒处理网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要处理这个网址,例如:

If I want to process this url for example:

post = new HttpPost("http://testurl.com/lists/lprocess?action=LoadList|401814|1");

因为它说,竖线(|)

的Java / Apache将不会让我的。是非法的

Java/Apache won't let me because it says that the vertical bar ("|") is illegal.

与双斜线逃脱它不工作,以及:

escaping it with double slashes doesn't work as well:

post = new HttpPost("http://testurl.com/lists/lprocess?action=LoadList\\|401814\\|1");

^,这并不正常工作。

^ that doesn't work as well.

任何建议如何使这项工作?

Any suggestions how to make this work?

推荐答案

URLEn coder.en code尝试()

注意:你应该带code字符串,它是继行动= 不是完整的URL

Note: you should encode string which is after action= not complete URL

post = new HttpPost("http://testurl.com/lists/lprocess?action="+URLEncoder.encode("LoadList|401814|1","UTF-8"));

这篇关于不能在Java / Apache的HttpClient的垂直/管棒处理网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 15:37