`
achieve2015
  • 浏览: 2415 次
社区版块
存档分类
最新评论

httpservletrequest paramater

阅读更多
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
分享到:
评论

相关推荐

    ParameterRequestUtils.java

    继承HttpServletRequestWrapper实现类,重新相关方法,实现自定义增加请求参数,通常是由于需要对参数进行特殊业务处理,然而HttpServletRequest的request.getPrameterMap是不允许修改的(被锁,可查看底层源码),...

    java web 修改request携带的参数信息

    一个非常棒的程序,用于修改request携带的参数信息。使用了filter等技术。

    基于i18n利用springboot实现后台国际化+源代码+文档说明

    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { } } ``` resolveLocale 方法作用就是我们的程序从哪获取指定的语言信息,我这里采用的是从header中...

    servlet2.4doc

    doOptions(HttpServletRequest, HttpServletResponse) - Method in class javax.servlet.http.HttpServlet Called by the server (via the service method) to allow a servlet to handle a OPTIONS request. ...

    filter对request请求拦截,对请求参数进行修改

    对request请求进行拦截,对请求参数修改。常用于前台提交表单参数关键字的过滤。此工具可以对参数拦截并转义后提交到对应的处理类。 除了添加两个JsFilter.java和GetHttpServletRequestWrapper.java之外,需要在web....

    springmybatis

    MyBatis 目录(?)[-] mybatis实战教程mybatis in action之一开发环境搭建 mybatis实战教程mybatis in action之二以接口的方式编程 mybatis实战教程mybatis in action之三实现数据的增删改查 mybatis实战教程mybatis ...

    springframework.5.0.12.RELEASE

    MethodParameter.isOptional() fails with ArrayIndexOutOfBoundsException [SPR-17629] #22160 MockMvcResultMatchers.forwardedUrl argument is not declared as nullable [SPR-17623] #22155 Cannot convert from...

    appfuse源码分析三(web)

    appfuse的webapp包下有这么几个包一:org.appfuse... private boolean isGZIPSupported(HttpServletRequest)通过request获得TableTagParameters.PARAMETER_EXPORTING的属性值。放到字符串exporting里。如果ex

    SPRING API 2.0.CHM

    MockHttpServletRequest MockHttpServletResponse MockHttpSession MockMultipartActionRequest MockMultipartFile MockMultipartHttpServletRequest MockPageContext MockPortalContext MockPortletConfig ...

    Myeclipse开发struts+hibernate+spring新手入门--环境配置---项目开发示例

    21 <message-resources parameter="ApplicationResources" /> 22 对应生成的formbean如下代码所示: 1 import javax.servlet.http.HttpServletRequest; 2 import org.apache.struts.action.ActionErrors; 3 ...

    ssh(structs,spring,hibernate)框架中的上传下载

    Struts+Spring+Hibernate实现上传下载    本文将围绕SSH文件上传下载的主题,向您详细讲述如何开发基于SSH的Web程序。SSH各框架的均为当前最新版本:  •Struts 1.2  •Spring 1.2.5  •Hibernate 3.0 ...

Global site tag (gtag.js) - Google Analytics