Class TemplateEngine


  • public class TemplateEngine
    extends TemplateEngine
    A template engine uses a specific template and the data in a routing context to render a resource into a buffer.

    Concrete implementations exist for several well-known template engines.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Field Detail

      • __TYPE_ARG

        public static final io.smallrye.mutiny.vertx.TypeArg<TemplateEngine> __TYPE_ARG
    • Constructor Detail

      • TemplateEngine

        public TemplateEngine​(io.vertx.ext.web.templ.TemplateEngine delegate)
    • Method Detail

      • render

        @Deprecated
        public io.smallrye.mutiny.Uni<Buffer> render​(RoutingContext context,
                                                     String templateFileName)
        Deprecated.
        Render the template

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        context - the routing context
        templateFileName - the template file name to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • renderAndAwait

        @Deprecated
        public Buffer renderAndAwait​(RoutingContext context,
                                     String templateFileName)
        Deprecated.
        Blocking variant of render(io.vertx.mutiny.ext.web.RoutingContext,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        context - the routing context
        templateFileName - the template file name to use
        Returns:
        the Buffer instance produced by the operation
      • render

        @Deprecated
        public io.smallrye.mutiny.Uni<Buffer> render​(RoutingContext context,
                                                     String templateDirectory,
                                                     String templateFileName)
        Deprecated.
        Render the template

        NOTE if you call method directly (i.e. not using TemplateHandler) make sure that templateFileName is sanitized via

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        context - the routing context
        templateDirectory - the template directory to use
        templateFileName - the relative template file name to use
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • renderAndAwait

        @Deprecated
        public Buffer renderAndAwait​(RoutingContext context,
                                     String templateDirectory,
                                     String templateFileName)
        Deprecated.
        Blocking variant of render(io.vertx.mutiny.ext.web.RoutingContext,String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        context - the routing context
        templateDirectory - the template directory to use
        templateFileName - the relative template file name to use
        Returns:
        the Buffer instance produced by the operation
      • isCachingEnabled

        public boolean isCachingEnabled()
        Overrides:
        isCachingEnabled in class TemplateEngine
        Returns:
        True if template files are cached; otherwise, false.
      • newInstance

        public static TemplateEngine newInstance​(io.vertx.ext.web.templ.TemplateEngine arg)