use of io.vertx.reactivex.core.http.HttpServerResponse in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toFlowable().subscribe(req -> {
HttpServerResponse resp = req.response();
String contentType = req.getHeader("Content-Type");
if (contentType != null) {
resp.putHeader("Content-Type", contentType);
}
resp.setChunked(true);
req.toFlowable().subscribe(resp::write, err -> {
}, resp::end);
});
server.listen(8080);
}
use of io.vertx.reactivex.core.http.HttpServerResponse in project knotx by Cognifide.
the class KnotxGatewayResponseProviderHandler method sendResponse.
private void sendResponse(final RoutingContext context, final ClientResponse clientResponse) {
HttpServerResponse httpResponse = context.response();
writeHeaders(context.response(), clientResponse);
httpResponse.setStatusCode(clientResponse.getStatusCode());
if (isOkClientResponse(clientResponse)) {
httpResponse.end(Buffer.newInstance(clientResponse.getBody()));
} else {
httpResponse.end();
}
}
use of io.vertx.reactivex.core.http.HttpServerResponse in project knotx by Cognifide.
the class KnotxAssemblerHandler method sendResponse.
private void sendResponse(final RoutingContext context, final ClientResponse clientResponse) {
HttpServerResponse httpResponse = context.response();
writeHeaders(context.response(), clientResponse);
httpResponse.setStatusCode(clientResponse.getStatusCode());
if (isOkClientResponse(clientResponse)) {
httpResponse.end(Buffer.newInstance(clientResponse.getBody()));
} else {
httpResponse.end();
}
}
Aggregations