Content negotiation was done via Response.Formatter:
get("/", (req, rsp) -> {
return rsp.format()
.when("text/html", () -> View.of("view", "model", new Model())
.when("application/json", () -> new Model());
});
After this change:
get("/", req -> {
return Results
.when("text/html", () -> View.of("view", "model", new Model())
.when("application/json", () -> new Model());
});
With Mvc Routes:
public class Mvc {
@Viewable("view")
@Path("/") @GET
public Model mvc() {
return new Model();
}
}
Now:
public class Mvc {
@Path("/") @GET
public Result mvc() {
return Results
.when("text/html", () -> View.of("view", "model", new Model())
.when("application/json", () -> new Model());
}
}
Content negotiation was done via Response.Formatter:
After this change:
With Mvc Routes:
Now: