【发布时间】:2017-05-04 09:13:13
【问题描述】:
html中的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">
控制器:
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 {
}
}
response.sendRedirect() 的 targetUrl 是:
https://sale.jd.com/act/UuzWBLwPKX.html
问题是何时重定向: chrome浏览器中的url变成:
https://sale.xxx.com//act//UuzWBLwPKX.html
哪个“act”前面的“/”变成了“//”,我不想要这个结果,为什么变成这个以及如何变成https://sale.xxx.com/act/UuzWBLwPKX.html
【问题讨论】:
标签: java http spring-mvc servlets