java web 获取到当前用户请求的完整url,包括参数

  String url = request.getScheme() + "://" +
                request.getServerName() +
                ("http".equals(request.getScheme()) && request.getServerPort() == 80 || "https".equals(request.getScheme()) && request.getServerPort() == 443 ? "" : ":" + request.getServerPort()) +
                request.getRequestURI() +
                (request.getQueryString() != null ? "?" + request.getQueryString() : "");

 

Leave a Comment

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据