请求的URL类似与localhost/server/test?url=http://somesite/aaa?a=中文1&b=中文2,参数中的url是别的接口提供的,可能有中文,也可能没有,也可能是%E6%B5%B7%E8%B4%BC%E7%8E%8B这种编码格式的。
test servlet中的doGet方法用 request.getParameter("url") 获取到url地址:“http://somesite/aaa?a=中文1&b=中文2”
print打印出来也是显示中文的。
然后要去连接到这个url地址,connection = (HttpURLConnection)(new URL(url).openConnection());
就会提示连接不上。
请问要怎么处理?
谢谢!