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
分享到:
相关推荐
继承HttpServletRequestWrapper实现类,重新相关方法,实现自定义增加请求参数,通常是由于需要对参数进行特殊业务处理,然而HttpServletRequest的request.getPrameterMap是不允许修改的(被锁,可查看底层源码),...
一个非常棒的程序,用于修改request携带的参数信息。使用了filter等技术。
public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) { } } ``` resolveLocale 方法作用就是我们的程序从哪获取指定的语言信息,我这里采用的是从header中...
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. ...
对request请求进行拦截,对请求参数修改。常用于前台提交表单参数关键字的过滤。此工具可以对参数拦截并转义后提交到对应的处理类。 除了添加两个JsFilter.java和GetHttpServletRequestWrapper.java之外,需要在web....
MyBatis 目录(?)[-] mybatis实战教程mybatis in action之一开发环境搭建 mybatis实战教程mybatis in action之二以接口的方式编程 mybatis实战教程mybatis in action之三实现数据的增删改查 mybatis实战教程mybatis ...
MethodParameter.isOptional() fails with ArrayIndexOutOfBoundsException [SPR-17629] #22160 MockMvcResultMatchers.forwardedUrl argument is not declared as nullable [SPR-17623] #22155 Cannot convert from...
appfuse的webapp包下有这么几个包一:org.appfuse... private boolean isGZIPSupported(HttpServletRequest)通过request获得TableTagParameters.PARAMETER_EXPORTING的属性值。放到字符串exporting里。如果ex
MockHttpServletRequest MockHttpServletResponse MockHttpSession MockMultipartActionRequest MockMultipartFile MockMultipartHttpServletRequest MockPageContext MockPortalContext MockPortletConfig ...
21 <message-resources parameter="ApplicationResources" /> 22 对应生成的formbean如下代码所示: 1 import javax.servlet.http.HttpServletRequest; 2 import org.apache.struts.action.ActionErrors; 3 ...
Struts+Spring+Hibernate实现上传下载 本文将围绕SSH文件上传下载的主题,向您详细讲述如何开发基于SSH的Web程序。SSH各框架的均为当前最新版本: •Struts 1.2 •Spring 1.2.5 •Hibernate 3.0 ...