Spring Web 中获取 HTTP 请求参数的方法

 

Spring Web 中获取 HTTP 请求参数的方法

 

RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
        if (servletRequestAttributes == null) {
            log.error("请求参数为空!");
            throw new BusinessException("请求参数为空!");
        }
        HttpServletRequest httpServletRequest = servletRequestAttributes.getRequest();

        String apiSign = httpServletRequest.getParameter("apiSign");

 

posted @ 2025-11-27 15:46  hapday  阅读(0)  评论(0)    收藏  举报