Package com.jetdrone.vertx.yoke

Examples of com.jetdrone.vertx.yoke.Yoke


    @Test
    public void testJsonBodyValidator() {

        final JsonObject json = new JsonObject().putObject("user", new JsonObject().putString("login", "paulo").putString("password", "pwd"));

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Router().post("/search/:from/:to", new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                com.jetdrone.vertx.yoke.util.Validator validator = new com.jetdrone.vertx.yoke.util.Validator(
                    that("param:from").is(Type.DateTime),
                    that("param:to").is(Type.DateTime),
View Full Code Here


    @Test
    public void testJsonBodyValidatorOptional() {

        final JsonObject json = new JsonObject().putObject("user", new JsonObject());

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {

                com.jetdrone.vertx.yoke.util.Validator validator = new com.jetdrone.vertx.yoke.util.Validator(
                    that("body:user.?login").is(Type.String)
View Full Code Here

    @Test
    public void testJsonBodyValidatorRequired() {

        final JsonObject json = new JsonObject().putObject("user", new JsonObject());

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                com.jetdrone.vertx.yoke.util.Validator validator = new com.jetdrone.vertx.yoke.util.Validator(
                    that("body:user.?login").is(Type.String)
                );
View Full Code Here

public class Limit extends TestVerticle {

    @Test
    public void testLimit() {
        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.Limit(1000));

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "text/plain");
        headers.add("content-length", "1024");
View Full Code Here

public class Session extends TestVerticle {

    @Test
    public void testSession() {
        final Yoke yoke = new Yoke(this);
        yoke.secretSecurity("keyboard cat");

        final Mac hmac = yoke.security().getMac("HmacSHA256");
        yoke.use(new CookieParser(hmac));
        yoke.use(new com.jetdrone.vertx.yoke.middleware.Session(hmac));
        yoke.use(new Router() {{
            get("/", new Handler<YokeRequest>() {
                @Override
                public void handle(YokeRequest request) {
                    request.response().end();
                }
View Full Code Here

    private static final String NEWLINE = System.getProperty("line.separator");

    @Test
    public void testEngine() {
        try {
            Yoke yoke = new Yoke(this);
            yoke.engine("hbs", new HandlebarsEngine("views"));
            yoke.use(new Middleware() {
                @Override
                public void handle(YokeRequest request, Handler<Object> next) {
                    request.put("name", "Paulo");
                    request.response().render("template.hbs", next);
                }
View Full Code Here

    }

    @Test
    public void testEngine2() {
        try {
            Yoke yoke = new Yoke(this);
            yoke.engine("hbs", new HandlebarsEngine("views"));
            yoke.use(new Middleware() {
                @Override
                public void handle(YokeRequest request, Handler<Object> next) {
                    List<Map> blogs = new ArrayList<>();
                    Map<String, String> blog1 = new HashMap<>();
                    blog1.put("name", "Handlebars.java");
View Full Code Here

        }
    }

    @Test
    public void testReuse() {
        Yoke yoke = new Yoke(this);
        yoke.engine("hbs", new HandlebarsEngine(""));
        yoke.use(new Middleware() {
            @Override
            public void handle(YokeRequest request, Handler<Object> next) {
                request.response().render("views/home.hbs");
            }
        });
View Full Code Here

        });
    }

    @Test
    public void testPartials() {
        Yoke yoke = new Yoke(this);
        yoke.engine("hbs", new HandlebarsEngine(""));
        yoke.use(new Middleware() {
            @Override
            public void handle(YokeRequest request, Handler<Object> next) {
                request.response().render("views/home2.hbs");
            }
        });
View Full Code Here

TOP

Related Classes of com.jetdrone.vertx.yoke.Yoke

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.