HttpServletRequest獲取header引數 sign

oktokeep發表於2024-06-08

HttpServletRequest獲取header引數 sign

//從請求頭中獲取引數
    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");

相關文章