新版仿ok交易所-后端
1
zyy
2026-03-08 74e5a0efcda0eff0f23037c3439ef5405bafe922
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.yami.trading.common.lang;
 
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
 
import javax.servlet.http.HttpServletRequest;
 
public class HttpContextUtil {
 
    public static HttpServletRequest getHttpServletRequest() {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        if(requestAttributes == null){
            return null;
        }
        return ((ServletRequestAttributes) requestAttributes).getRequest();
    }
}