APISonar


com.blade.mvc.RouteContext.json

> com > blade > mvc > RouteContext > json
com APIs blade APIs mvc APIs RouteContext APIs json APIs

Example 1
private static void updates(RouteContext ctx) {
        int queries = getQueries(ctx.fromString("queries", "1"));

        List<Integer> idList = generateIdList(queries);

        List<World> worlds = idList.stream()
                .map(id -> select().from(World.class).byId(id))
                .peek(Application::updateWorld).collect(toList());

        ctx.json(worlds).contentType(JSON_CONTENT_TYPE).header(SERVER_HEADER, SERVER_VALUE);
    }
Example 2
private static void db(RouteContext ctx) {
        World world = select().from(World.class).byId(generateId());
        ctx.json(world).contentType(JSON_CONTENT_TYPE).header(SERVER_HEADER, SERVER_VALUE);
    }