的URL在HTML:HttpServletResponse的使URL正斜杠(/)变成两个正斜杠(//)
<a href=""////jrdc.xxx.com/dh/nc?camp=19&mid=19&mat=121&unit=-&uuid=386931bea19dbba0e8f8c3291743d004a71669b5807d3eb49e150e08fcd93c83&aid=12&day=1493864666856&to=https://sale.xxx.com/act/UuzWBLwPKX.html" target="_blank">
的contronller:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public void clickLog(HttpServletRequest request, HttpServletResponse response) {
try {
//
String targetUrl = request.getParameter("to");
if(targetUrl != null && !targetUrl.contains("http")){
targetUrl = "http://" + targetUrl;
}
response.sendRedirect(targetUrl);
}catch (Exception e){
}finally {
}
}
的targetUrl这个以response.sendRedirect是()是:
https://sale.jd.com/act/UuzWBLwPKX.html
的问题是,当重定向: 的Chrome浏览器的URL变为:
https://sale.xxx.com//act//UuzWBLwPKX.html
其“行为”与“/”前成为“//”,我不希望这样的结果,为什么变成这个问题以及如何成为https://sale.xxx.com/act/UuzWBLwPKX.html
感谢关注 – Fanl