java.lang.Object
io.jstach.opt.spring.webflux.example.hello.HelloController

@Controller public class HelloController extends Object
Example hello world controller using different ways to use JStachio for web development.
Author:
agentgt
  • Constructor Summary

    Constructors
    Constructor
    Description
    Placate JDK 18 Javadoc
  • Method Summary

    Modifier and Type
    Method
    Description
    Here we use JStachio runtime to resolve the renderer (in this case we are calling them Views) via Springs Http Message Converter.
    org.springframework.web.reactive.result.view.View
    mvc()
    Here we use JStacheInterfaces to make our model implement a Spring View to support the traditional servlet MVC approach.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • hello

      @GetMapping("/") @ResponseBody public HelloModel hello()
      Here we use JStachio runtime to resolve the renderer (in this case we are calling them Views) via Springs Http Message Converter.
      Returns:
      the model that will be used to find the correct view and then rendered using that view
      See Also:
      API Note
      Notice that the method has to be annotated with @ResponseBody.
    • mvc

      @GetMapping("/webflux") public org.springframework.web.reactive.result.view.View mvc()
      Here we use JStacheInterfaces to make our model implement a Spring View to support the traditional servlet MVC approach. The model will use the static jstachio singleton that will be the spring one.

      This approach has pros and cons. It makes your models slightly coupled to Spring MVC but allows you to return different views if say you had to redirect on some inputs (RedirectView).

      Returns:
      the model that will be used as View
      See Also:
      API Note
      Notice that the return type is View.