Search in sources :

Example 46 with Javalin

use of io.javalin.Javalin in project Artemis by mbizhani.

the class TestServer method main.

public static void main(String[] args) {
    final Javalin app = Javalin.create().start(8080);
    configure(app);
}
Also used : Javalin(io.javalin.Javalin)

Example 47 with Javalin

use of io.javalin.Javalin in project yardstick by atlarge-research.

the class RemoteControlledExperiment method before.

@Override
protected void before() {
    Javalin app = Javalin.create(config -> {
        config.defaultContentType = "application/json";
    }).routes(() -> {
        path("player", () -> {
            path("control", () -> {
                path("add", () -> get(this::addPlayer));
                path("list", () -> get(this::playerList));
            });
            path("behavior", () -> {
                path("command", () -> post(this::giveCommands));
                path("status", () -> post(this::getStatus));
            });
        });
        path("stop", () -> get(ctx -> {
            this.done = true;
            ctx.result("done");
        }));
    }).start(7000);
    app.get("/", ctx -> ctx.result("Hello World"));
}
Also used : Javalin(io.javalin.Javalin)

Aggregations

Javalin (io.javalin.Javalin)47 Test (org.junit.jupiter.api.Test)9 ApiBuilder.get (io.javalin.apibuilder.ApiBuilder.get)4 Context (io.javalin.http.Context)4 Config (org.devocative.artemis.cfg.Config)4 Server (org.eclipse.jetty.server.Server)4 OpenApiPlugin (io.javalin.plugin.openapi.OpenApiPlugin)3 Info (io.swagger.v3.oas.models.info.Info)3 Map (java.util.Map)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Context (io.javalin.Context)2 Handler (io.javalin.Handler)2 ApiBuilder.path (io.javalin.apibuilder.ApiBuilder.path)2 Plugin (io.javalin.core.plugin.Plugin)2 ExceptionHandler (io.javalin.http.ExceptionHandler)2 Handler (io.javalin.http.Handler)2 HandlerEntry (io.javalin.http.HandlerEntry)2 HandlerType (io.javalin.http.HandlerType)2