Package org.vertx.java.core.http

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


  }

  @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

              }
            });
      }
    });

    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

        final RackApplication app;
        boolean ssl = config.getBoolean("ssl");
        try {
            app = new RackApplication((WrappedVertx) vertx, runtime.getCurrentContext(), rackApplication, config);
            httpServer.setAcceptBacklog(10000);
            httpServer.requestHandler(new Handler<HttpServerRequest>() {
                public void handle(final HttpServerRequest req) {
                    app.call(req);
                }
            });
            if (config.containsField("event_bus")) {
View Full Code Here

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

        // Set request handler, use route matcher if a route handler is provided.
        if (routeMatcherHandler == null) {
            server.requestHandler(jerseyHandler);
        } else {
            RouteMatcher rm = new RouteMatcher();
            String pattern = jerseyHandler.getBaseUri().getPath() + "*";
            rm.all(pattern, jerseyHandler);
            routeMatcherHandler.handle(rm);
View Full Code Here

        JerseyHandler handler = jerseyHandlerProvider.get();
        if (handler == null) {
            throw new IllegalStateException("A JerseyHandlerProvider has not been configured");
        }
        handler.init(vertx, container);
        server.requestHandler(handler);

        if (receiveBufferSize > 0) {
            // TODO: This doesn't seem to actually affect buffer size for dataHandler.  Is this being used correctly or is it a Vertx bug?
            server.setReceiveBufferSize(receiveBufferSize);
        }
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

  public WebAdmin(final Verticle verticle) {
    final Vertx vertx = verticle.getVertx();

    HttpServer server = vertx.createHttpServer();
    server.requestHandler(new Handler<HttpServerRequest>() {

      @Override
      public void handle(HttpServerRequest request) {
        Path path = Paths.get(request.uri);
View Full Code Here

            server.setReceiveBufferSize(receiveBufferSize);
        }

        // Set request handler, use route matcher if a route handler is provided.
        if (routeMatcherHandler == null) {
            server.requestHandler(jerseyHandler);
        } else {
            RouteMatcher rm = new RouteMatcher();
            String pattern = jerseyHandler.getBaseUri().getPath() + "*";
            rm.all(pattern, jerseyHandler);
            routeMatcherHandler.handle(rm);
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.