Package spark

Interface TemplateViewRoute

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface TemplateViewRoute
    A TemplateViewRoute is built up by a path. TemplateViewRoute instead of returning the result of calling toString() as body, it returns the result of calling render method. The primary purpose is provide a way to create generic and reusable components for rendering output using a Template Engine. For example to render objects to html by using Freemarker template engine..
    • Method Detail

      • handle

        ModelAndView handle​(Request request,
                            Response response)
                     throws java.lang.Exception
        Invoked when a request is made on this route's corresponding path e.g. '/hello'
        Parameters:
        request - The request object providing information about the HTTP request
        response - The response object providing functionality for modifying the response
        Returns:
        The content to be set in the response
        Throws:
        java.lang.Exception - when handle fails