io.micronaut.views.ModelAndView Java Examples

The following examples show how to use io.micronaut.views.ModelAndView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Database.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Get(value = "/fortunes", produces = "text/html;charset=utf-8")
public Single<ModelAndView<Map>> fortune() {
    return dbRepository.fortunes().toList().flatMap(fortunes -> {
        fortunes.add(new Fortune(0, "Additional fortune added at request time."));
        fortunes.sort(comparing(fortune -> fortune.message));
        return Single.just(new ModelAndView<>("fortunes", Collections.singletonMap("fortunes", fortunes)));
    });
}
 
Example #2
Source File: EchoMicronautController.java    From micronaut-aws with Apache License 2.0 4 votes vote down vote up
@Get("/render-html")
@Produces(MediaType.TEXT_HTML)
public ModelAndView getHtmlFromRenderEngine(Context context) {
    ModelAndView mav = new ModelAndView("home", CollectionUtils.mapOf("firstname", "Luke", "lastname", "Skywalker"));
    return mav;
}