您的位置:首页 > 理论基础 > 计算机网络

非action层获取HttpServletRequest

2015-08-29 14:56 435 查看
1.如何在一个线程的任何地方(即其他层)获取HttpServletRequest

Ineveryrequest,the
DispatcherServlet
bindsthecurrent
HttpServletRequest
toa
staticThreadLocal
objectinthe
RequestContextHolder
.Youcanretrieveitwhenexecutingwithinthesame
Thread
with

HttpServletRequestrequest=((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: