Answer the question
In order to leave comments, you need to log in
How to work with Java vertx in Intellij idea?
Hello! Please tell me how to work with java vertx from intellij idea ...
I tried to generate a maven project, then I ran mvn idea:idea, as a result I got some kind of incomprehensible thing with a bunch of generated files, etc.
Then I tried to simply create an empty java project and added the following code to the main class:
class Server {
public static void main(String[] args) throws IOException {
DefaultVertxFactory f = new DefaultVertxFactory();
Vertx vertx = f.createVertx();
vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() {
public void handle(HttpServerRequest req) {
System.out.println("Got request: " + req.uri());
System.out.println("Headers are: ");
for (Map.Entry<String, String> entry : req.headers()) {
System.out.println(entry.getKey() + ":" + entry.getValue());
}
req.response().headers().set("Content-Type", "text/html; charset=UTF-8");
req.response().end("Hello vertx!!!");
}
}).listen(8080);
System.in.read();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question