- 获取服务端访问信息
public static String getUrl(HttpServletRequest request){ String url = ""; if(request != null){ String scheme = request.getScheme(); String host = request.getLocalAddr(); int post = request.getLocalPort(); String contextPath = request.getContextPath(); url = scheme + "://" + host + ":" + String.valueOf(post) + "/" + contextPath + "/"; } return url; }