如何解析httpservletrequest无法转换为自定义httpservletrequestwrapper

h22fl7wq  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(249)

控制器代码为

@SuppressWarnings("unchecked")
    @RequestMapping(value = "/abc/test.do", method = RequestMethod.GET)
    public ModelAndView getData(@RequestParam(value="qName", required=true) String qName,                                           
                                           HttpServletRequest request,
                                           Model model) {        

        OverridableHttpRequest myRequest = (OverridableHttpRequest) request;

--overridablehttprequest如下

public class OverridableHttpRequest extends HttpServletRequestWrapper implements
        HttpServletRequest {
    private Map<String, String> newParams;
    private Set<String> removedParams;
    public OverridableHttpRequest(HttpServletRequest requestToWrap) {
        super(requestToWrap);
        this.newParams = new HashMap<String, String>();
        this.removedParams = new HashSet<String>();
    }
}

我正在升级到SpringBoot2.4.2

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题