獲取項目服務器地址、項目名稱、以及路徑

獲取項目運行服務器地址以及相關路徑
  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()); //參數
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章