【发布时间】:2020-04-17 12:41:56
【问题描述】:
我正在尝试在启动期间添加日志条目,并在请求得到响应后立即添加(使用ctx.addBodyEndHandler)。
下面的函数foo应该是什么aaa?
private void foo(io.vertx.reactivex.ext.web.RoutingContext ctx) {
long start = System.currentTimeMillis();
String uuid = ctx.get("RequestIdentifier");
String clientAddress = ctx.request().remoteAddress().host();
LOG.info("Request ID: {}. Client IP: {}. Application type: {}. HTTP Method: {}. Body {}. Processing route: {}", uuid, clientAddress, this.getClientDescription(ctx.request()), ctx.request().method(), this.getRequestBody(ctx), ctx.request().uri());
ctx.addBodyEndHandler(ign -> {
LOG.info("Request ID: {} completed in {} ms. Response {}. Response code {}.", uuid, System.currentTimeMillis() - start, aaa, ctx.response().getStatusCode());
});
// more logic
}
【问题讨论】:
标签: http url-routing vert.x