码迷,mamicode.com
首页 > 编程语言 > 详细

Spring HttpServletRequest对象的获取

时间:2018-01-30 12:07:53      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:context   span   str   aliyun   servlet   attr   value   autowire   thold   

1、Controller方法上获取

@RequestMapping(value = "/aliyun/ccc/callComing", method = RequestMethod.POST)
public String callComing(HttpServletRequest request) {
}

2、通过注解

@Autowired
HttpServletRequest request;

3、通过代码获取

((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()

 

Spring HttpServletRequest对象的获取

标签:context   span   str   aliyun   servlet   attr   value   autowire   thold   

原文地址:https://www.cnblogs.com/zxguan/p/8383646.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!