Examples of requestHandler()


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

    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

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

      }
    });

    // 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

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

      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

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

  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

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

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

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

  @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

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

        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

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

        // Init jersey handler
        jerseyHandler.init(configurator);

        // Set request handler for the baseUri
        RouteMatcher rm = new RouteMatcher();
        server.requestHandler(rm);
        // regex pattern will be: "^base_path/.*"
        String pattern = "^" + jerseyHandler.getBaseUri().getPath() + ".*";
        rm.all(pattern, jerseyHandler);

        // Add any additional routes if handler is provided
View Full Code Here

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

  }

  @Override
  public void start() {
    HttpServer server = vertx.createHttpServer();
    server.requestHandler(new Handler<HttpServerRequest>() {
      @Override
      public void handle(HttpServerRequest request) {
        String filePath = WEB_ROOT;
        String requestPath = request.path();
        if(requestPath.equals("/")) {
View Full Code Here

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

              }
            });
      }
    });

    server.requestHandler(matcher).listen(rest.getInteger("port", 1987),
        rest.getString("host", "0.0.0.0"), new AsyncResultHandler<HttpServer>() {
          @Override
          public void handle(AsyncResult<HttpServer> ar) {
            if (!ar.succeeded()) {
              result.setFailure(ar.cause());
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.