in restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HandleMethodExecutor.java [44:63]
public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
HandleContext<Handler> handleContext = (HandleContext<Handler>) msg;
try {
Handler handler = handleContext.getMappingContext().payload();
Object[] args = handleContext.getArgs();
Object handleResult = handler.execute(args);
FullHttpResponse httpResponse = handleContext.getHttpResponse();
if (null != handleResult) {
String mimeType = HttpUtil.getMimeType(handler.getProducing()).toString();
ResponseBodySerializer serializer = ResponseBodySerializerFactory.getResponseBodySerializer(mimeType);
byte[] bodyBytes = serializer.serialize(handleResult);
populateHttpResponse(httpResponse, handler.getProducing(), bodyBytes, handler.getHttpStatusCode());
} else {
populateHttpResponse(httpResponse, handler.getProducing(), new byte[0], handler.getHttpStatusCode());
}
ctx.writeAndFlush(httpResponse);
} finally {
ReferenceCountUtil.release(handleContext.getHttpRequest());
}
}