Rest with Vert.x for java

flyzb 13-06-22
         

Rest with Scala and Vert.x


支持restful java with vert.x的代码如下:


public class SampleResticle extends Verticle {

public void start() {
HttpServer server = vertx.createHttpServer();
RouteMatcher routeMatcher = new RouteMatcher();
routeMatcher.get("/hello", new Handler<HttpServerRequest>() {
public void handle(HttpServerRequest req) {
req.response.statusCode =200;
req.response.end(
"world");
}
});
server.requestHandler(routeMatcher).listen(8080,
"localhost");
}
}

         

1
lshoo
2013-07-06 11:04

我也在关注Vert.x2.0。不知道什么原因,Vertx在国内关注和讨论的不多。