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

2021-12-08 08:43:56 浏览数 (1)

代码语言:javascript复制
  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() : "");

0 人点赞