use of io.vertx.rxjava.core.http.HttpServer in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable().subscribe(req -> {
req.response().putHeader("content-type", "text/html").end("<html><body><h1>Hello from vert.x!</h1></body></html>");
});
server.listen(8080);
}
use of io.vertx.rxjava.core.http.HttpServer in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable().subscribe(req -> {
req.response().putHeader("content-type", "application/json").end(new JsonObject().put("time", System.currentTimeMillis()).toString());
});
server.listen(8080);
}
use of io.vertx.rxjava.core.http.HttpServer in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable().subscribe(req -> {
HttpServerResponse resp = req.response();
String contentType = req.getHeader("Content-Type");
if (contentType != null) {
resp.putHeader("Content-Type", contentType);
}
resp.setChunked(true);
req.toObservable().subscribe(resp::write, err -> {
}, resp::end);
});
server.listen(8080);
}
use of io.vertx.rxjava.core.http.HttpServer in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable().subscribe(req -> {
req.response().putHeader("content-type", "text/html").end("<html><body><h1>Hello from vert.x!</h1></body></html>");
});
server.listen(8080);
}
use of io.vertx.rxjava.core.http.HttpServer in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
HttpServer server = vertx.createHttpServer();
server.requestStream().toObservable().subscribe(req -> {
req.response().putHeader("content-type", "application/json").end(new JsonObject().put("time", System.currentTimeMillis()).toString());
});
server.listen(8080);
}
Aggregations