HttpServletRequest获取header参数 sign

2024-10-09 11:25:14 浏览数 (2)

HttpServletRequest获取header参数 sign

代码语言:javascript复制
//从请求头中获取参数
    private static Map<String, String> getHeaders(HttpServletRequest request) {
        Map<String, String> headerMap = new HashMap<>();
        Enumeration<String> enumeration = request.getHeaderNames();
        while (enumeration.hasMoreElements()) {
            String name    = enumeration.nextElement();
            String value = request.getHeader(name);
            headerMap.put(name, value);
        }
        return headerMap;
    }

    //获取请求头中的签名
String signStr = headers.get("byte-signature");

0 人点赞