String baseUrl=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort+request.getContextPath()+"/";
得到形如http://www.baidu.com:8080/xxx
從HttpServletRequest獲取:
request.getRemoteAddr()獲取ip
request.getRemotePort()獲取埠號
request.getServletPath()獲取請求地址