<!-- WEB.XML中配置相关的监听机制 -->
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
//在任意的class下通过以下方法获取到HttpServletRequest
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
java Spring中配置获取HttpServletRequest的环境
最新推荐文章于 2024-02-05 22:47:48 发布