Search in sources :

Example 6 with HttpServer

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);
}
Also used : HttpServer(io.vertx.rxjava.core.http.HttpServer)

Example 7 with HttpServer

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("{\"message\":\"Hello World\"}");
    });
    server.listen(8080);
}
Also used : HttpServer(io.vertx.rxjava.core.http.HttpServer)

Example 8 with HttpServer

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("{\"message\":\"Hello World\"}");
    });
    server.listen(8080);
}
Also used : HttpServer(io.vertx.rxjava.core.http.HttpServer)

Aggregations

HttpServer (io.vertx.rxjava.core.http.HttpServer)8 JsonObject (io.vertx.core.json.JsonObject)2 HttpServerResponse (io.vertx.rxjava.core.http.HttpServerResponse)1