HttpServletRequest常用获取URL的方法
来源:互联网 发布:怎么开淘宝直播间 编辑:程序博客网 时间:2024/06/05 18:26
1、request.getRequestURL()
返回的是完整的url,包括Http协议,端口号,servlet名字和映射路径,但它不包含请求参数。
2、request.getRequestURI()
得到的是request URL的部分值,并且web容器没有decode过的
3、request.getContextPath()
返回 the context of the request.
4、request.getServletPath()
返回调用servlet的部分url.
5、request.getQueryString()
返回url路径后面的查询字符串
示例:
当前url:http://localhost:8080/CarsiLogCenter_new/idpstat.jsp?action=idp.sptopn
request.getRequestURL() http://localhost:8080/CarsiLogCenter_new/idpstat.jsp
request.getRequestURI() /CarsiLogCenter_new/idpstat.jsp
request.getContextPath()/CarsiLogCenter_new
request.getServletPath() /idpstat.jsp
request.getQueryString()action=idp.sptopn
0 0
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL相关的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- 【javaWeb】HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest常用获取URL的方法
- HttpServletRequest——获取URL的方法
- HttpServletRequest获取URL的相关方法
- QiYu Admin-架构搭建
- 【驱动】linux下I2C驱动架构全面分析
- 抽奖程序总结
- notepad++
- 181- 整数A转化为整数B
- HttpServletRequest常用获取URL的方法
- 有关IO流中覆盖问题
- 除了北上广深,程序员的归宿还有哪些城市?
- git使用
- 51单片机--LED类编程技巧续
- nginx负载均衡策略
- 2.3产品需求文档BRD
- 现在主流开源分布式系统架构都有哪些? dubbo zookeeper springmvc mybatis shiro restful redis
- css设置各种中文字体如雅黑、黑体、宋体、楷体等等