Tomcat中存在一些URL包含空格的问题。要解决此问题,您需要使用编码网址
URLEnprer。
示例(注意空格):
String url="http://example.org/test test2/index.html";String enpredURL=java.net.URLEnprer.enpre(url,"UTF-8");System.out.println(enpredURL); //outputs http%3A%2F%2Fexample.org%2Ftest+test2%2Findex.html



