首页 > Web开发 > 详细

Web应用中request获取各种获取path或URI,URL的方法

时间:2016-07-10 08:39:44      阅读:286      评论:0      收藏:0      [点我收藏+]

Web应用中有各种获取path或URI,URL的方法,假设网页访问地址:

http://localhost:8080/tradeload/TestServlet

Web应用context: /tradeload 

各路径鉴定如下:

request.getContextPath()= /tradeload
request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()= http://localhost:8080
request.getRequestURL() = http://localhost:8080/tradeload/TestServlet
request.getRequestURI() = /tradeload/TestServlet
request.getPathInfo() = null
request.getServletPath() = /TestServlet
getServletContext().getRealPath(‘/‘) = C:\server\glassfish\domains\domain1\applications\j2ee-modules\tradeload\

 

原文出处:http://improve.iteye.com/blog/741427

 

Web应用中request获取各种获取path或URI,URL的方法

原文:http://www.cnblogs.com/chenlei123/p/5657066.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!