Class ThymeleafMixin.Builder

java.lang.Object
org.apache.juneau.rest.server.view.thymeleaf.ThymeleafMixin.Builder
All Implemented Interfaces:
ViewMixinBuilder<ThymeleafMixin.Builder>
Enclosing class:
ThymeleafMixin

Builder for ThymeleafMixin.

Mirrors ThymeleafDispatcher.Builder's configuration methods on its own surface and forwards each call into a held ThymeleafDispatcher.Builder (worker-bean composition). Implements ViewMixinBuilder so basePath(String) and cacheTemplates(boolean) are guaranteed to transfer to the sibling JSP / Mustache / FreeMarker bridge builders.

  • Constructor Details

  • Method Details

    • basePath

      Sets the classpath base path under which template resources are resolved.

      Defaults to "/". A typical configured value is "/templates/" — the Spring-Boot-compatible layout convention.

      Specified by:
      basePath in interface ViewMixinBuilder<ThymeleafMixin.Builder>
      Parameters:
      value - The base path. null or blank values reset to the default ThymeleafMixin.DEFAULT_BASE_PATH.
      Returns:
      This object.
    • cacheTemplates

      public ThymeleafMixin.Builder cacheTemplates(boolean value)
      Sets whether the bridge's default engine caches resolved templates.

      Defaults to true (production-safe). Set to false during development to pick up edits without restarting the server. This setting only applies to the bridge's fallback engine; if a TemplateEngine bean is registered, its own caching configuration is honored.

      Specified by:
      cacheTemplates in interface ViewMixinBuilder<ThymeleafMixin.Builder>
      Parameters:
      value - The new value.
      Returns:
      This object.
    • templateMode

      public ThymeleafMixin.Builder templateMode(org.thymeleaf.templatemode.TemplateMode value)
      Sets the template mode used by the bridge's default engine.

      Defaults to HTML. Other modes (`XML`, `TEXT`, `JAVASCRIPT`, `CSS`, `RAW`) work if the user supplies templates in that mode; engines that want mixed-mode support should register a custom @Bean TemplateEngine with multiple resolvers instead.

      Parameters:
      value - The new value. null resets to ThymeleafMixin.DEFAULT_TEMPLATE_MODE.
      Returns:
      This object.
    • getBasePath

      public String getBasePath()
      Reads the current base path setting (test/inspection helper).
      Returns:
      The base path. Never null.
    • isCacheTemplates

      public boolean isCacheTemplates()
      Reads the current cache-templates setting (test/inspection helper).
      Returns:
      The cache flag.
    • getTemplateMode

      public org.thymeleaf.templatemode.TemplateMode getTemplateMode()
      Reads the current template-mode setting (test/inspection helper).
      Returns:
      The template mode. Never null.
    • build

      Builds the ThymeleafMixin.
      Returns:
      A new ThymeleafMixin instance.