HttpServletRequest 获取URL的方法
2016-01-06 00:00
726 查看
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协议,端口号,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
相关文章推荐
- 使用HttpAsyncClient进行异步获取数据
- Tcp/Ip Http Socket的区别
- http https ssl/tls三者的区别和联系
- iOS开发网络篇之文件下载、大文件下载、断点下载
- 第四十天-http与www服务基础概念详解
- 打造先进的内存KV数据库-5 TCP侦听
- 详解HTTP中的摘要认证机制
- 网络文章影响力挖掘
- web应用 http 响应 url uri
- 【iCore3 双核心板】例程二十六:MODBUS TCP实验——电源监控
- tcpdump 抓 tcp 包
- 【SpringMVC】文件上传Expected MultipartHttpServletRequest: is a MultipartResolver错误解决
- httpservletresponse下的重定向和springmvc下的重定向的区别
- HTTP的长连接和短连接——Node上的测试
- 图解 TCP/IP 协议
- C++的iostream标准库介绍+使用详解(转)http://www.eetop.cn/blog/html/93/493893-14953.html
- [连载]《C#通讯(串口和网络)框架的设计与实现》- 12.二次开发及应用
- JAVA网络编程之UDP
- CentOS_2_网络连接
- cin http://www.cnblogs.com/A-Song/archive/2012/01/29/2331204.html