Skip to content
Handlers-http provides a minimal and adaptable interface for developing web applications on the vert-x3 platform.
Java
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.travis.yml
LICENSE.txt
README.md
pom.xml

README.md

Vert.x handlers-http

Handlers-http provides a minimal and adaptable interface for developing web applications on the vert-x3 platform.

Handlers-http is an open webframework for the vert-x3 platform. The middleware layer doesn't depend on any custom classes, so components should be easily inter-changeable with different webframeworks.

Inspired by 'Build You Own Web Framework In Go'

Build Status

Setup server request handlers

    
ServerRequestHandlers<Void> handlers = use(
        new ExceptionHandler<>(),
        new ResponseTimeHandler<>(),
        new TimeoutHandler<>(vertx),
        (f, n) -> (req, arg) -> {
            req.response().end("hello world!");
            n.accept(req, arg);
        });

var handler = handlers.apply(
        (e, a) -> logger.error(a),
        (e, a) -> logger.info(a));

server.requestHandler(req -> handler.accept(req, null))
        .listen();

Implement server request handlers

public class HandlerImpl implements BiFunction<BiConsumer<HttpServerRequest, Throwable>,
        BiConsumer<HttpServerRequest, Void>, BiConsumer<HttpServerRequest, Void>> {

    @Override
    public BiConsumer<HttpServerRequest, Void> apply(
        BiConsumer<HttpServerRequest, Throwable> fail, BiConsumer<HttpServerRequest, Void> next) {
            return next;
    }
}

Remarks

  • Implementing handler still is quite verbose.

Example

https://github.com/spriet2000/vertx-handlers-http-example

Installation

<dependency>
    <groupId>com.github.spriet2000</groupId>
    <artifactId>vertx-handlers-http</artifactId>
    <version>0.1.0-SNAPSHOT</version>
</dependency>
You can’t perform that action at this time.