java中取得客户端连接url方法

request.getProtocol() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getSession().getServletContext().getContextPath() + request.getServletPath() + "?" + request.getQueryString();

简单的方法
request.getRequestURL().toString() + "?"
                + request.getQueryString();

你可能感兴趣的:(java)