Java中获得完整的URl字符串

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

 

相关文章:

  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案