Skip to content

Commit

Permalink
com.feilong.spring.web.util.WebSpringUtil.getRequest() 应该用
Browse files Browse the repository at this point in the history
currentRequestAttributes fix #684
  • Loading branch information
venusdrogon committed Jan 24, 2024
1 parent 352d9cb commit c98b5fc
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ private WebSpringUtil(){
* @see org.springframework.web.util.WebUtils#getNativeRequest(ServletRequest, Class)
* @since 1.10.0
* @since 4.0.0 加上异常处理,如果出现异常返回null
* @since 4.0.8 use call currentRequestAttributes instead of getRequestAttributes see https://github.com/ifeilong/feilong/issues/684
*/
public static HttpServletRequest getRequest(){
try{
//the RequestAttributes currently bound to the thread, or null if none bound
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
if (null == servletRequestAttributes){
return null;
}
Expand Down

0 comments on commit c98b5fc

Please sign in to comment.