use of io.vertx.core.http.HttpServerResponse in project java-chassis by ServiceComb.
the class TestVertxRestServer method setUp.
@Before
public void setUp() throws Exception {
Router mainRouter = Router.router(null);
mainRouter.route().handler(BodyHandler.create());
instance = new VertxRestServer(mainRouter) {
@Override
protected RestOperationMeta findRestOperation(RestServerRequestInternal restRequest) {
return super.findRestOperation(restRequest);
}
@Override
public void sendFailResponse(RestServerRequestInternal restRequest, HttpServerResponse httpResponse, Throwable throwable) {
}
};
}
use of io.vertx.core.http.HttpServerResponse in project java-chassis by ServiceComb.
the class GrpcServerInvoke method sendSuccessResponse.
private void sendSuccessResponse(Invocation invocation, Response response) {
Buffer buffer = null;
try {
buffer = GrpcCodec.encodeResponse(invocation, response, operationProtobuf);
} catch (Exception e) {
LOGGER.error("grpc encode success response failed.", e);
sendFailResponse(e);
return;
}
HttpServerResponse httpServerResponse = routingContext.response();
httpServerResponse.putTrailer("grpc-status", "0");
httpServerResponse.end(buffer);
ChannelHandlerContext ctx = (ChannelHandlerContext) ReflectionUtils.getField(ctxfield, httpServerResponse);
ctx.flush();
}
Aggregations