我想做一个rest-put与一个etag从get接收到一个特定的资源,使用头if-match。我看到它不支持这个标题,我想知道是否有任何解决办法。我可以计算控制器中的etag吗?我是否应该发送get请求以查看etag是否同时更改?但在我的put请求到达服务器之前,这可能会改变。我怎么处理?
@ApiResponses({
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 500, message = "System Error")
})
@ApiOperation(value = "returns the updated meal", response = MealDTO.class, produces = MediaType.APPLICATION_JSON_VALUE)
@PutMapping("/meal/{mealId}")
public MealDTO updateMeal(
@ApiParam(name = "userId", type = "long", value = "ID of the User", example = "-1")
@PathVariable Long userId,
@ApiParam(name = "mealId", type = "long", value = "ID of the meal", example = "-1")
@PathVariable Long mealId,
@ApiParam(name = "mealDTO", type = "MealDTO")
@RequestBody MealDTO mealDTO
) throws Exception {
log.debug("Entered class = MealController & method = updateMeal");
// do something with ShallowEtagHeaderFilter Bean here maybe?
mealDTO.setId(mealId);
var result = this.mealService.updateMeal(mealDTO, userId);
socketHandler.notifySessions(result, Action.UPDATE, userId);
return result;
}
暂无答案!
目前还没有任何答案,快来回答吧!