Search in sources :

Example 66 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class MapsVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 67 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class EventBusReceiverVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 68 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class EventBusVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    List<Future> futures = new ArrayList<>();
    futures.add(LocalPeerToPeer.createLocalPeerToPeer(vertx));
    futures.add(DistributedPeerToPeer.createDistributedPeerToPeer(vertx));
    futures.add(LocalPublish.createLocalPublish(vertx));
    futures.add(DistributedPublish.createDistributedPublish(vertx));
    futures.add(LocalRequestReply.createLocalRequestReply(vertx));
    futures.add(DistributedRequestReply.createDistributedRequestReply(vertx));
    futures.add(DistributedTimeout.createDistributedTimeout(vertx));
    CompositeFuture allHandlers = CompositeFuture.all(futures);
    return allHandlers.compose(cf -> {
        Future<HttpServer> future = Future.future();
        Router router = setupRouter(cf.list());
        vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
        return future;
    });
}
Also used : CompositeFuture(io.vertx.core.CompositeFuture) ArrayList(java.util.ArrayList) HttpServer(io.vertx.core.http.HttpServer) CompositeFuture(io.vertx.core.CompositeFuture) Future(io.vertx.core.Future) Router(io.vertx.ext.web.Router)

Example 69 with HttpServer

use of io.vertx.core.http.HttpServer in project vertx-openshift-it by cescoffier.

the class LocksVerticle method startHttpServer.

private Future<HttpServer> startHttpServer() {
    Future<HttpServer> future = Future.future();
    Router router = setupRouter();
    vertx.createHttpServer().requestHandler(router::accept).listen(8080, future);
    return future;
}
Also used : HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router)

Example 70 with HttpServer

use of io.vertx.core.http.HttpServer in project georocket by georocket.

the class GeoRocket method deployHttpServer.

/**
 * Deploy the http server.
 * @return a single that will complete when the http server was started.
 */
protected Single<HttpServer> deployHttpServer() {
    String host = config().getString(ConfigConstants.HOST, ConfigConstants.DEFAULT_HOST);
    int port = config().getInteger(ConfigConstants.PORT, ConfigConstants.DEFAULT_PORT);
    Router router = createRouter();
    HttpServerOptions serverOptions = createHttpServerOptions();
    try {
        HttpServer server = vertx.createHttpServer(serverOptions);
        ObservableFuture<HttpServer> observable = RxHelper.observableFuture();
        server.requestHandler(router::accept).listen(port, host, observable.toHandler());
        return observable.toSingle();
    } catch (Throwable t) {
        return Single.error(t);
    }
}
Also used : HttpServerOptions(io.vertx.core.http.HttpServerOptions) HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router) GeneralEndpoint(io.georocket.http.GeneralEndpoint) Endpoint(io.georocket.http.Endpoint) StoreEndpoint(io.georocket.http.StoreEndpoint)

Aggregations

HttpServer (io.vertx.core.http.HttpServer)82 Router (io.vertx.ext.web.Router)37 HttpServerOptions (io.vertx.core.http.HttpServerOptions)32 Test (org.junit.Test)24 JsonObject (io.vertx.core.json.JsonObject)17 Buffer (io.vertx.core.buffer.Buffer)14 HttpServerResponse (io.vertx.core.http.HttpServerResponse)14 Future (io.vertx.core.Future)12 HttpClient (io.vertx.core.http.HttpClient)12 Vertx (io.vertx.core.Vertx)11 CountDownLatch (java.util.concurrent.CountDownLatch)10 Handler (io.vertx.core.Handler)9 HttpMethod (io.vertx.core.http.HttpMethod)9 VertxOptions (io.vertx.core.VertxOptions)8 HttpClientOptions (io.vertx.core.http.HttpClientOptions)8 List (java.util.List)8 AbstractVerticle (io.vertx.core.AbstractVerticle)7 PemKeyCertOptions (io.vertx.core.net.PemKeyCertOptions)7 AtomicReference (java.util.concurrent.atomic.AtomicReference)7 AsyncResult (io.vertx.core.AsyncResult)6