spriet2000 / vertx-http-router

The vertx-http-router is using a radix tree to match incoming requests. It extracts parameters and provides them using a map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vert.x http-router

Build Status

Performance

Throughput in operations per second

Regex router Vert.x http-router
219136.313 864257.727

You can measure it on your own machine by using the BenchmarkRunner. The http-router should be at least 3 times faster than a regex based RouteMatcher.

Details about the comparison can be found here.

Example

    RouteHandler printUser = (req, params) -> req.
            response().end(params.get(":action") + " " + params.get(":user"));

    RouteHandler printPath = (req, params) -> req.
            response().end("filepath " + params.get("*filepath"));

    Router router = router()
            .get("/api/:user/:action", printUser)
            .get("/*filepath", printPath);

    server.requestHandler(router)
            .listen();

Current state

  • make it feature complete
  • make it stable
  • improve performance

Goals for this router:

  • simple and lightweight
  • easy to integrate
  • high performance
  • scalable

Installation

Maven

    <dependency>
        <groupId>com.github.spriet2000</groupId>
        <artifactId>vertx-http-router</artifactId>
        <version>0.0.2-SNAPSHOT</version>
    </dependency>

Without maven

https://oss.sonatype.org/content/repositories/snapshots/com/github/spriet2000

Thanks

Thanks to Tahseen Ur Rehman, Javid Jamae and Dennis Heidsiek for their clear implementation of a radix tree in java which helped me getting started.

And many thanks to Julien Schmidt for his excellent httprouter!

About

The vertx-http-router is using a radix tree to match incoming requests. It extracts parameters and provides them using a map.

License:Apache License 2.0


Languages

Language:Java 100.0%