从Header中获取值

代码如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

/**
 * 硬件校准信息上报
 */
@PostMapping("/client/calibration/report")
@PassToken
public ResponseVo<Object> clientCalibrationReport(
        @RequestHeader(value = "terminal") Integer terminal,
        @Valid @RequestBody ClientCalibrationReportRequest request) {

    clientCalibrationReportService.saveClientCalibrationReport(terminal, request);

    return ResponseVo.createSuccess();
}

参考资料

  1. java 获取HttpRequest Header 的几种方法