Java中获取完整的url

HttpServletRequest httpRequest=(HttpServletRequest)request;  
          
String strBackUrl = "http://" + request.getServerName() //服务器地址  
                    + ":"   
                    + request.getServerPort()           //端口号  
                    + httpRequest.getContextPath()      //项目名称  
                    + httpRequest.getServletPath()      //请求页面或其他地址  
                + "?" + (httpRequest.getQueryString()); //参数  

  

posted @ 2017-07-25 15:33  爱喝牛奶的面包  阅读(444)  评论(0编辑  收藏  举报