Java中获取完整的url

Java中获得完整的URl字符串

 

  1. HttpServletRequest httpRequest=(HttpServletRequest)request;  
  2.           
  3. String strBackUrl = "http://" + request.getServerName() //服务器地址  
  4.                     + ":"   
  5.                     + request.getServerPort()           //端口号  
  6.                     + request.getContextPath()      //项目名称  
  7.                     + request.getServletPath()      //请求页面或其他地址  
  8.                 + "?" + (request.getQueryString()); //参数  
posted @ 2017-02-22 19:45  旧巷里的旧少年  阅读(1545)  评论(0编辑  收藏  举报