Package com.jetdrone.vertx.yoke

Examples of com.jetdrone.vertx.yoke.Yoke


public class ThymeleafEngineTest extends TestVerticle {

    @Test
    public void testEngine() {
        Yoke yoke = new Yoke(this);
        yoke.engine("html", new ThymeleafEngine("views"));
        yoke.use(new Middleware() {
            @Override
            public void handle(YokeRequest request, Handler<Object> next) {
                request.put("home.welcome", "Hi there!");
                request.response().render("template.html");
            }
View Full Code Here


public class YokeRequestTest extends TestVerticle {

    @Test
    public void testAccept() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertNotNull(request.accepts("application/json"));
                testComplete();
            }
View Full Code Here

        new YokeTester(yoke).request("GET", "/", headers, null);
    }

    @Test
    public void testNormalizedPath() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertEquals("/pom.xml", request.normalizedPath());
                testComplete();
            }
View Full Code Here

        new YokeTester(yoke).request("GET", "/./me/../pom.xml", null);
    }

    @Test
    public void testNormalizedPath2() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertEquals("/", request.normalizedPath());
                testComplete();
            }
View Full Code Here

        new YokeTester(yoke).request("GET", "/", null);
    }

    @Test
    public void testNormalizedPath3() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertNull(request.normalizedPath());
                testComplete();
            }
View Full Code Here

        new YokeTester(yoke).request("GET", "/%2e%2e%2f", null);
    }

    @Test
    public void testNormalizedPath4() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertNull(request.normalizedPath());
                testComplete();
            }
View Full Code Here

        new YokeTester(yoke).request("GET", "/%2e%2e/", null);
    }

    @Test
    public void testNormalizedPath5() {
        final Yoke yoke = new Yoke(this);
        yoke.use(new Middleware() {
            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
                assertNull(request.normalizedPath());
                testComplete();
            }
View Full Code Here

import static org.vertx.testtools.VertxAssert.testComplete;

public class Compress extends TestVerticle {
  @Test
  public void testGzipCompress() {
    Yoke yoke = new Yoke(this);
    yoke.use(new com.jetdrone.vertx.yoke.middleware.Compress());
    yoke.use(new Middleware() {
      @Override
      public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
        request.response().end(new JsonObject().putString("hello", "world"));
      }
    });
View Full Code Here

public class Favicon extends TestVerticle {

    @Test
    public void testFavicon() {
        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.Favicon());

        final Buffer icon = Utils.readResourceToBuffer(com.jetdrone.vertx.yoke.middleware.Favicon.class, "favicon.ico");

        new YokeTester(yoke).request("GET", "/favicon.ico", new Handler<Response>() {
            @Override
View Full Code Here

public class Validator extends TestVerticle {

    @Test
    public void testParam() {
        final Yoke yoke = new Yoke(this);

        yoke.use(new Router().get("/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

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.