拼写网站路径

public String getPath() {
int port = request().getServerPort();
String portStr = "";
if(port != 80){
portStr = ":"+port;
}
String path = request().getScheme() + "://" + request().getServerName()
+ portStr + request().getContextPath()
+ "/";
return path;
}

protected HttpServletRequest request(){
return ServletActionContext.getRequest();
}
原文地址:https://www.cnblogs.com/chchao/p/5126857.html