STARTING VERT.X IN [email protected]
MAKE NEW MAVEN PROJECT
ADD ARCHETYPE
NOW IT’S HERE
BUILD THE PROJECT AND…
SET RUN CONFIGURATION
SET RUN CONFIGURATION
SET RUN CONFIGURATION
SUCCESS!
CREATE HTTP VERTICLE
http://vertx.io/core_manual_java.html#writing-http-servers
public class HttpVerticle extends Verticle {
public void start() {HttpServer server = vertx.createHttpServer();server.requestHandler(new Handler<HttpServerRequest>() {
public void handle(HttpServerRequest request) {StringBuilder sb = new StringBuilder();for (Map.Entry<String, String> header : request.headers()
.entries()) {sb.append(header.getKey()).append(": ")
.append(header.getValue()).append("\n");}request.response().putHeader("content-type", "text/plain");request.response().end(sb.toString());
}});server.listen(8080, "localhost");
}}
BEFORE RUN…
change verticle class to run
AND RUN. THEN…
Run with configuration we made
Top Related