-
springmvc其他类获取request记得web.xml
- <listener>
- <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
- </listener>
- public static HttpServletRequest getRequest(){
- HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- return req;
- }
-
- public static HttpServletResponse getResponse(){
- HttpServletResponse resp = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
- return resp;
- }
- @Autowired
- private HttpSession session;
-
- @Autowired
- private HttpServletRequest request;
-
相关阅读:
USACO 3.1
linux 逻辑卷管理 调整分区大小
记录一下
ADOX创建ACCESS数据库列名的数据类型
使用jstack分析cpu消耗过高的问题
fastadmin添加定时任务
linux定时任务
技术域
IOS div上下滑动效果
mysql根据时间统计数据语句
-
原文地址:https://www.cnblogs.com/liangbo-/p/8885498.html
Copyright © 2020-2023
润新知