springmvc 获取请求头信息
@PostMapping("/test/post") public void post(@RequestBody String params, @RequestHeader(required = false, value = "contentType") String contentType, @RequestHeader(required = false, value = "Accept") String Accept) { System.out.println("contentType:" + contentType); System.out.println("Accept:" + Accept); JSONObject json = JSONObject.parseObject(params); String userName = json.getString("username"); System.out.println("userName:" + userName); }