Package org.vertx.java.core.http

Examples of org.vertx.java.core.http.HttpServer.requestHandler()


    logger = container.logger();
   
    HttpServer server = vertx.createHttpServer();

    // Also serve the static resources. In real life this would probably be done by a CDN
    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path().equals("/")) req.response().sendFile("eventbusbridge/index.html"); // Serve the index.html
        if (req.path().endsWith("vertxbus.js")) req.response().sendFile("eventbusbridge/vertxbus.js"); // Serve the js
      }
    });
View Full Code Here


    logger = container.logger();
   
    HttpServer server = vertx.createHttpServer();

    // Also serve the static resources. In real life this would probably be done by a CDN
    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path().equals("/")) req.response().sendFile("ebb_memleak_test/index.html"); // Serve the index.html
        if (req.path().endsWith("vertxbus.js")) req.response().sendFile("ebb_memleak_test/vertxbus.js"); // Serve the js
      }
    });
View Full Code Here

public class SockJSExample extends Verticle {

  public void start() {
    HttpServer server = vertx.createHttpServer();

    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path().equals("/")) req.response().sendFile("sockjs/index.html"); // Serve the html
      }
    });
View Full Code Here

    RouteMatcher routeMatcher = new RouteMatcher();

    // HTTP server
    HttpServer httpServer = vertx.createHttpServer();
    httpServer.requestHandler(routeMatcher);

    // SockJS server
    JsonArray permitted = new JsonArray();
    permitted.add(new JsonObject()); // Let everything through
    SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
View Full Code Here

      }
    });

    // HTTP server
    HttpServer httpServer = vertx.createHttpServer();
    httpServer.requestHandler(routeMatcher);

    // SockJS server
    JsonArray permitted = new JsonArray();
      permitted.add(new JsonObject()); // Let everything through
      SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
View Full Code Here

      server.setSSL(true).setKeyStorePassword(getOptionalStringConfig("key_store_password", "wibble"))
                         .setKeyStorePath(getOptionalStringConfig("key_store_path", "server-keystore.jks"));
    }

    if (getOptionalBooleanConfig("static_files", true)) {
      server.requestHandler(this);
    }

    boolean bridge = getOptionalBooleanConfig("bridge", false);
    if (bridge) {
      SockJSServer sjsServer = vertx.createSockJSServer(server);
View Full Code Here

  public void start() throws Exception {
    HttpServer server = vertx.createHttpServer();

    // Also serve the static resources. In real life this would probably be done by a CDN
    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path.equals("/")) req.response.sendFile("eventbusbridge/index.html"); // Serve the index.html
        if (req.path.endsWith("vertxbus.js")) req.response.sendFile("eventbusbridge/vertxbus.js"); // Serve the js
      }
    });
View Full Code Here

public class SockJSExample extends Verticle {

  public void start() {
    HttpServer server = vertx.createHttpServer();

    server.requestHandler(new Handler<HttpServerRequest>() {
      public void handle(HttpServerRequest req) {
        if (req.path.equals("/")) req.response.sendFile("sockjs/index.html"); // Serve the html
      }
    });
View Full Code Here

  @Override
  public void start() {
    super.start();

    HttpServer server = vertx.createHttpServer();
    server.requestHandler(this);

    // Configure SSL.
    if (getOptionalBooleanConfig("ssl", false)) {
      server.setSSL(true)
          .setKeyStorePassword(getOptionalStringConfig("keyStorePassword", "password"))
View Full Code Here

        logger = container.getLogger();

        HttpServer server = vertx.createHttpServer();

        server.requestHandler(new Handler<HttpServerRequest>() {
            public void handle(HttpServerRequest request) {
                String output = null;
                HttpServerResponse response = request.response;

                if(request.path.equals("/translate")) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.