httpRequest请求的一些常用操作

获取请求地址

HttpServletRequest request = (HttpServletRequest) arg0;

String url = request.getRequestURI();

 

方法

http://localhost:7001/myservlet/somepath/test?someparam=somevalue     
  request.getPathInfo():返回/somepath/test     
  request.getRequestURL():返回http://localhost:7001/myservlet/somepath/test     
  request.getRequestURI():返回/myservlet/somepath/test     
  request.getServletPath():返回/myservlet     
  request.getQueryString():返回someparam=somevalue

posted @ 2017-02-21 11:36  codedom  阅读(153)  评论(0编辑  收藏  举报