@Override
protected void channelRead0(ChannelHandlerContext ctx, QueryRequest msg) throws Exception {
byte[] buf;
try {
buf = JsonUtil.getObjectMapper().writeValueAsBytes(dataStore.query(msg));
} catch (TimelyException e) {
if (e.getMessage().contains("No matching tags")) {
LOG.trace(e.getMessage());
} else {
LOG.error(e.getMessage(), e);
}
this.sendHttpError(ctx, e);
return;
}
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
Unpooled.copiedBuffer(buf));
response.headers().set(Names.CONTENT_TYPE, Constants.JSON_TYPE);
response.headers().set(Names.CONTENT_LENGTH, response.content().readableBytes());
sendResponse(ctx, response);
}
HttpQueryRequestHandler.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:timely
作者:
评论列表
文章目录