我向剩余API发出POST请求的方法粘贴在下面。在APIGateWay上启用了缓存。如何在我的帖子请求中添加缓存键?我正在使用jax-rs建立请求。 https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html#enable-api-gateway-cache-keys
public static Response callWebTarget(WebTarget webTarget, String apiPath, String apiGatewayKey, String payloadJson, Map<String, Object> headerList) {
Invocation.Builder builder = webTarget
.path(apiPath)
.request(MediaType.APPLICATION_JSON)
.header(API_KEY_HEADER, apiGatewayKey);
for (Map.Entry<String, Object> headerEntry : headerList.entrySet()) {
builder.header(headerEntry.getKey(),headerEntry.getValue());
}
return builder.post(Entity.json(payloadJson));
}