获取当前线程上下文信息方法

public class CurrentContextUtils {

/**
* 返回当前线程上下文request信息
*
* @return
*/
public static HttpServletRequest getCurrentRequestInfo() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getRequest();
}

/**
* 返回当前线程上下文response信息
*
* @return
*/
public static HttpServletResponse getCurrentResponseInfo() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
return servletRequestAttributes.getResponse();
}
}
posted @ 2020-04-22 18:30  明天,你好啊  阅读(2351)  评论(0编辑  收藏  举报