2020
11-19
11-19
SpringBoot获取Request和Response方法代码解析
通过静态方法获取,你也可以封装一个静态方法出来@GetMapping(value="")publicStringcenter(){ServletRequestAttributesservletRequestAttributes=(ServletRequestAttributes)RequestContextHolder.getRequestAttributes();HttpServletRequestrequest=servletRequestAttributes.getRequest();HttpServletResponseresponse=servletRequestAttributes.getResponse();//...}通过参数直接获取,只要在你的方法上...
继续阅读 >