001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.console.freemarker; 018 019import static org.apache.juneau.commons.utils.Shorts.*; 020 021import java.io.*; 022import java.util.*; 023import java.util.function.UnaryOperator; 024 025import org.apache.juneau.rest.server.*; 026import org.apache.juneau.console.*; 027import org.apache.juneau.rest.server.staticfile.WebJarResolver; 028import org.apache.juneau.rest.server.view.freemarker.*; 029 030import freemarker.cache.*; 031import freemarker.template.*; 032 033/** 034 * A {@link FreemarkerMixin} that additionally makes the reserved-classpath admin-console chrome template 035 * ({@code org/apache/juneau/console/base.ftlh}) — and the {@code <@tag>} macro it defines — resolvable 036 * from any consumer template, without shadowing the consumer's own {@code basePath}-rooted template tree. 037 * 038 * <h2 class='section'>Used INSTEAD OF {@link FreemarkerMixin}, not beside it:</h2> 039 * <p> 040 * Register it typed as either {@link FreemarkerMixin} or {@code ConsoleFreemarkerMixin} — both declared 041 * return types work. {@code FreemarkerViewRenderer} finds the exact-type {@code FreemarkerMixin} bean when one is 042 * registered, and otherwise also looks for a bean declared under any registered subtype, which this class 043 * registers via a static initializer: 044 * 045 * <p class='bjava'> 046 * <ja>@Bean</ja> <jk>public</jk> FreemarkerMixin freemarker() { 047 * <jk>return</jk> ConsoleFreemarkerMixin.<jsm>create</jsm>().basePath(<js>"/templates/"</js>).build(); 048 * } 049 * </p> 050 * 051 * <p> 052 * or equivalently: 053 * 054 * <p class='bjava'> 055 * <ja>@Bean</ja> <jk>public</jk> ConsoleFreemarkerMixin freemarker() { 056 * <jk>return</jk> ConsoleFreemarkerMixin.<jsm>create</jsm>().basePath(<js>"/templates/"</js>).build(); 057 * } 058 * </p> 059 * 060 * <h2 class='section'>Consumer {@code /templates} is never shadowed:</h2> 061 * <p> 062 * The augmented {@link Configuration}'s {@code TemplateLoader} tries the consumer's own {@code basePath}-derived 063 * loader <b>first</b>; the reserved template is addressed by its full classpath-root-relative path 064 * ({@link #BASE_TEMPLATE_PATH}) on a second, classpath-<b>root</b>-rooted {@link ClassTemplateLoader}, so it cannot 065 * collide with a consumer path such as {@code /templates/base.ftlh}. Consumer templates include it with a 066 * loader-root-absolute path: 067 * 068 * <p class='bftl'> 069 * <#include "/org/apache/juneau/console/base.ftlh"> 070 * </p> 071 * 072 * <h2 class='section'>Consumer-supplied {@code Configuration} is the same instance, then fill-missing stamped:</h2> 073 * <p> 074 * When the request's {@code BeanStore} already has a {@code Configuration} bean (Spring/Spring-Boot autoconfig, or 075 * a microservice {@code BasicBeanStore.put}), {@link #resolveConfiguration} still returns that <b>same instance</b> 076 * ({@code ==}) so consumer settings win (encoding, {@code ObjectWrapper}, {@code exposeFields}, template-update 077 * delay, output format). It then fill-missing-stamps the reserved console shared variables 078 * ({@code page}, {@code card}, {@code navigation}, {@code node}, {@code theme}, {@code token}, {@code console}, 079 * {@code main}, the {@code <@console>} slot names {@code head}/{@code scripts}/{@code brand}/{@code actions}/ 080 * {@code title}/{@code footer}/{@code body}, and {@code jcTagHtml}) and splices the 081 * reserved-path console loader only when {@link #BASE_TEMPLATE_PATH} would not already resolve. A name the 082 * consumer already set is left alone. There is no opt-out flag on this class — opt out by registering 083 * {@link FreemarkerMixin} instead of {@code ConsoleFreemarkerMixin}. 084 * 085 * @since 10.0.0 086 */ 087@SuppressWarnings({ 088 "java:S3776" // Validation and rendering chains many independent guards; splitting them adds no clarity. 089}) 090public class ConsoleFreemarkerMixin extends FreemarkerMixin { 091 092 static { 093 FreemarkerMixin.registerSubtype(ConsoleFreemarkerMixin.class); 094 } 095 096 /** 097 * The reserved classpath-root-relative location of the shipped console chrome template 098 * (defines the {@code <@tag>} macro). Load-bearing for the collision-free-namespacing argument in the class 099 * javadoc — do not shorten. 100 */ 101 public static final String BASE_TEMPLATE_PATH = "org/apache/juneau/console/base.ftlh"; 102 103 /** Default consumer chrome template included by {@code <@page>} when none is configured. */ 104 public static final String DEFAULT_CHROME_TEMPLATE = "base.ftlh"; 105 106 private final String chromeTemplate; 107 private final ToolkitPackRegistry packs; 108 private final CardRequirements cardRequirements; 109 private final CardTypeRegistry cardTypes; 110 private final boolean devMode; 111 private final ClassLoader adopterLoader; 112 private final String adopterRoot; 113 114 /** 115 * No-arg constructor — mirrors {@link FreemarkerMixin#FreemarkerMixin()} so the mixin walk's 116 * {@code BeanInstantiator} is not forced to depend on builder-detection alone. 117 */ 118 public ConsoleFreemarkerMixin() { 119 this(create()); 120 } 121 122 /** 123 * Builder constructor. 124 * 125 * @param builder The builder. Must not be {@code null}. 126 * @throws IllegalArgumentException If the toolkit packs, provided packs or card requirements don't validate. 127 * @throws IllegalStateException E-70 if a required pack reaches a WebJar that is not on the classpath 128 * (see {@link Builder#requirePacks(String...)}). 129 */ 130 protected ConsoleFreemarkerMixin(Builder builder) { 131 super(builder); 132 this.chromeTemplate = builder.chromeTemplate; 133 this.packs = new ToolkitPackRegistry(); 134 builder.extraPacks.forEach(packs::register); 135 packs.provide(builder.providedPacks).validate(); 136 packs.requireKnown(builder.requiredPacks, "requirePacks"); 137 var roots = new LinkedHashSet<>(builder.requiredPacks); 138 for (var p : builder.extraPacks) 139 if (packs.reaches(p.name(), ToolkitPackRegistry.PACK_ECHARTS)) 140 roots.add(p.name()); 141 packs.checkWebJars(roots, builder.webJarProbe); 142 this.cardRequirements = builder.cardRequirements.build(packs); 143 this.cardTypes = builder.cardTypes.build(); 144 this.devMode = builder.devMode; 145 this.adopterLoader = builder.adopterLoader; 146 this.adopterRoot = builder.adopterRoot; 147 } 148 149 /** @return The configured consumer chrome template name; read by {@code PageSpec.view()} when no template is set. */ 150 String chromeTemplate() { return chromeTemplate; } 151 152 /** @return The card-type registry, including custom {@code Builder.cardType(...)} handlers. */ 153 CardTypeRegistry cardTypes() { return cardTypes; } 154 155 /** 156 * Creates a new builder. 157 * 158 * @return A new builder. 159 */ 160 @SuppressWarnings({ 161 "java:S9149" // Intentional per-subclass builder-factory override matching FreemarkerMixin.create()'s own convention; each mixin subclass returns its own nested Builder type. 162 }) 163 public static Builder create() { 164 return new Builder(); 165 } 166 167 // Double-checked-locking identity cache: resolveConfiguration is called once per request, and 168 // super.resolveConfiguration(req) returns the SAME Configuration object on every call for a given mixin 169 // instance (consumer bean or FreemarkerDispatcher's lazy default cache). Tracking that object's identity 170 // here means "have I already stamped THIS exact object" is answered in O(1). Presence checks on the loader 171 // and shared-variable names still run on a cache miss so N Rest resources sharing one Spring singleton 172 // do not nest Multi(Multi(base, console), console). 173 @SuppressWarnings({ 174 "java:S3077" // volatile is required here for correct double-checked-locking safe-publication; the reference is publish-once (fully constructed/wrapped before assignment) and never compound-mutated. 175 }) 176 private volatile Configuration wrappedConfiguration; 177 178 /** 179 * Resolves the active {@link Configuration} and fill-missing-stamps console shared variables onto it. 180 * 181 * <p> 182 * Always delegates to {@code super.resolveConfiguration(req)} first so a consumer {@code Configuration} bean 183 * wins for settings. Then: 184 * <ol class='spaced-list'> 185 * <li><b>Fill-missing names:</b> {@code page}, {@code card}, {@code navigation}, {@code node}, 186 * {@code theme}, {@code token}, {@code console}, {@code main}, the {@code <@console>} slot names 187 * ({@code head}, {@code scripts}, {@code brand}, {@code actions}, {@code title}, {@code footer}, 188 * {@code body}), and {@code jcTagHtml} are set only when {@code getSharedVariable(name)} is unset. A 189 * consumer value is kept. 190 * <li><b>Loader splice:</b> the classpath-root console {@link ClassTemplateLoader} is wrapped in only when 191 * {@link #BASE_TEMPLATE_PATH} would not already resolve through the current loader. 192 * <li><b>Wrap-once + presence:</b> identity-cached per mixin instance so a second call does not 193 * re-wrap; presence checks so N Rest resources sharing one Spring singleton {@code Configuration} do 194 * not nest {@link MultiTemplateLoader}. 195 * </ol> 196 * 197 * @param req The current REST request. 198 * @return The active FreeMarker configuration. Never {@code null}. 199 */ 200 @Override 201 public Configuration resolveConfiguration(RestRequest req) { 202 var base = super.resolveConfiguration(req); 203 if (base == wrappedConfiguration) 204 return base; 205 synchronized (this) { 206 if (base != wrappedConfiguration) { 207 spliceConsoleLoaderIfNeeded(base); 208 fillMissingConsoleSharedVariables(base); 209 wrappedConfiguration = base; 210 } 211 } 212 return base; 213 } 214 215 /** 216 * Wraps the current {@link TemplateLoader} with a classpath-root console loader only when 217 * {@link #BASE_TEMPLATE_PATH} would not resolve. Presence-checked so a second mixin instance sharing the 218 * same {@code Configuration} does not nest {@link MultiTemplateLoader}. 219 */ 220 private void spliceConsoleLoaderIfNeeded(Configuration cfg) { 221 if (reservedTemplateResolves(cfg)) 222 return; 223 var console = new ConsoleTemplateLoader(getClass().getClassLoader()); 224 var existing = cfg.getTemplateLoader(); 225 if (n(existing)) 226 cfg.setTemplateLoader(console); 227 else 228 cfg.setTemplateLoader(new MultiTemplateLoader(new TemplateLoader[]{ existing, console })); 229 } 230 231 /** 232 * Classpath loader that only resolves names inside the console template package, so splicing it into a 233 * {@link Configuration} never exposes the rest of the classpath. 234 */ 235 static final class ConsoleTemplateLoader extends ClassTemplateLoader { 236 237 private static final String PREFIX = "org/apache/juneau/console/"; 238 239 ConsoleTemplateLoader(ClassLoader loader) { 240 super(loader, ""); 241 } 242 243 @Override /* TemplateLoader */ 244 public Object findTemplateSource(String name) throws IOException { 245 var n = name.startsWith("/") ? name.substring(1) : name; 246 if (! n.startsWith(PREFIX) || n.contains("..")) 247 return null; 248 return super.findTemplateSource(name); 249 } 250 } 251 252 /** 253 * Whether the reserved console chrome template is already visible on {@code cfg}'s loader. Uses 254 * {@link TemplateLoader#findTemplateSource(String)} so a miss is not cached as a failed 255 * {@link Configuration#getTemplate(String)}. 256 */ 257 private static boolean reservedTemplateResolves(Configuration cfg) { 258 var loader = cfg.getTemplateLoader(); 259 if (n(loader)) 260 return false; 261 try { 262 var source = loader.findTemplateSource(BASE_TEMPLATE_PATH); 263 if (n(source)) 264 return false; 265 loader.closeTemplateSource(source); 266 return true; 267 } catch (@SuppressWarnings("unused") Exception e) { 268 return false; // Loader probe failed; treat as unresolved and splice. 269 } 270 } 271 272 /** 273 * Sets each reserved console shared variable only when that name is unset on {@code cfg}. 274 */ 275 private void fillMissingConsoleSharedVariables(Configuration cfg) { 276 if (n(cfg.getSharedVariable(TagMethodModel.NAME))) 277 cfg.setSharedVariable(TagMethodModel.NAME, new TagMethodModel()); 278 if (n(cfg.getSharedVariable(PageDirectiveModel.NAME))) { 279 cfg.setSharedVariable(PageDirectiveModel.NAME, new PageDirectiveModel(chromeTemplate, packs)); 280 } 281 if (n(cfg.getSharedVariable(CardDirectiveModel.NAME))) 282 cfg.setSharedVariable(CardDirectiveModel.NAME, new CardDirectiveModel(cardRequirements, cardTypes)); 283 if (n(cfg.getSharedVariable(NavigationDirectiveModel.NAME))) 284 cfg.setSharedVariable(NavigationDirectiveModel.NAME, new NavigationDirectiveModel()); 285 if (n(cfg.getSharedVariable(NodeDirectiveModel.NAME))) 286 cfg.setSharedVariable(NodeDirectiveModel.NAME, new NodeDirectiveModel()); 287 if (n(cfg.getSharedVariable(ThemeDirectiveModel.NAME))) 288 cfg.setSharedVariable(ThemeDirectiveModel.NAME, new ThemeDirectiveModel()); 289 if (n(cfg.getSharedVariable(TokenDirectiveModel.NAME))) 290 cfg.setSharedVariable(TokenDirectiveModel.NAME, new TokenDirectiveModel()); 291 if (n(cfg.getSharedVariable(ConsoleDirectiveModel.NAME))) 292 cfg.setSharedVariable(ConsoleDirectiveModel.NAME, new ConsoleDirectiveModel(devMode, cardTypes, packs)); 293 if (n(cfg.getSharedVariable(MainDirectiveModel.NAME))) 294 cfg.setSharedVariable(MainDirectiveModel.NAME, new MainDirectiveModel()); 295 if (n(cfg.getSharedVariable(HasToolkitMethodModel.NAME))) 296 cfg.setSharedVariable(HasToolkitMethodModel.NAME, new HasToolkitMethodModel()); 297 if (nn(adopterLoader) && n(cfg.getSharedVariable(AssetUrlMethodModel.NAME))) 298 cfg.setSharedVariable(AssetUrlMethodModel.NAME, new AssetUrlMethodModel(adopterLoader, adopterRoot, devMode)); 299 // The seven capture-only slot directives share one parameterized class, one instance registered per slot name. 300 for (var slot : ConsoleSlotDirectiveModel.SLOT_NAMES) 301 if (n(cfg.getSharedVariable(slot))) 302 cfg.setSharedVariable(slot, new ConsoleSlotDirectiveModel(slot)); 303 if (n(cfg.getSharedVariable(TopicDirectiveModel.NAME))) 304 cfg.setSharedVariable(TopicDirectiveModel.NAME, new TopicDirectiveModel()); 305 if (n(cfg.getSharedVariable(BridgeDirectiveModel.NAME))) 306 cfg.setSharedVariable(BridgeDirectiveModel.NAME, new BridgeDirectiveModel()); 307 if (n(cfg.getSharedVariable(BadgeDirectiveModel.NAME))) 308 cfg.setSharedVariable(BadgeDirectiveModel.NAME, new BadgeDirectiveModel()); 309 if (n(cfg.getSharedVariable(FactsDirectiveModel.NAME))) 310 cfg.setSharedVariable(FactsDirectiveModel.NAME, new FactsDirectiveModel()); 311 } 312 313 /** 314 * Builder for {@link ConsoleFreemarkerMixin}. 315 */ 316 public static class Builder extends FreemarkerMixin.Builder { 317 318 String chromeTemplate = DEFAULT_CHROME_TEMPLATE; 319 final List<ToolkitPack> extraPacks = new ArrayList<>(); 320 final List<String> providedPacks = new ArrayList<>(); 321 final List<String> requiredPacks = new ArrayList<>(); 322 UnaryOperator<String> webJarProbe = WebJarResolver::resolvePath; 323 final CardRequirements.Builder cardRequirements = CardRequirements.create(); 324 final CardTypeRegistry.Builder cardTypes = CardTypeRegistry.standard().copy(); 325 boolean devMode = Boolean.getBoolean("juneau.console.devMode"); 326 ClassLoader adopterLoader; 327 String adopterRoot = ""; 328 329 /** Constructor — package access for {@link ConsoleFreemarkerMixin#create()}. */ 330 protected Builder() {} 331 332 /** 333 * {@inheritDoc} 334 * 335 * <p> 336 * Covariantly narrowed to this {@code Builder} so a fluent chain can mix inherited setters 337 * (e.g. {@link #basePath(String)}) with the console-specific {@link #chromeTemplate(String)} / 338 * {@link #registerToolkitPack(ToolkitPack)} in any order. 339 */ 340 @Override 341 public Builder basePath(String value) { 342 super.basePath(value); 343 return this; 344 } 345 346 /** 347 * Sets the consumer chrome template that {@code <@page>} includes after capturing its body. 348 * 349 * <p> 350 * Resolved on the consumer's own {@code basePath}-rooted loader. Defaults to 351 * {@link ConsoleFreemarkerMixin#DEFAULT_CHROME_TEMPLATE}. 352 * 353 * @param chromeTemplate The chrome template name. Must not be {@code null}. 354 * @return This object. 355 */ 356 public Builder chromeTemplate(String chromeTemplate) { 357 this.chromeTemplate = chromeTemplate; 358 return this; 359 } 360 361 /** 362 * Registers an app-supplied {@link ToolkitPack.Kind#RUNTIME} toolkit pack with no dependencies. 363 * 364 * <p> 365 * Same as {@link #registerToolkitPack(ToolkitPack)} with {@code kind(RUNTIME)} and the default resolver. 366 * 367 * @param name The pack name. 368 * @param cssPaths Ordered CSS asset paths. 369 * @param jsPaths Ordered JS asset paths. 370 * @return This object. 371 */ 372 public Builder registerToolkitPack(String name, List<String> cssPaths, List<String> jsPaths) { 373 return registerToolkitPack(ToolkitPack.create(name).css(cssPaths).js(jsPaths).kind(ToolkitPack.Kind.RUNTIME).build()); 374 } 375 376 /** 377 * Registers an app-supplied toolkit pack. 378 * 379 * <p> 380 * A pack with the name of a built-in or earlier pack replaces it completely, including its 381 * {@code dependsOn}. {@link #build()} validates the pack graph. 382 * 383 * @param pack The pack. 384 * @return This object. 385 */ 386 public Builder registerToolkitPack(ToolkitPack pack) { 387 extraPacks.add(rnn(pack)); 388 return this; 389 } 390 391 /** 392 * Names packs the app's chrome already loads. A provided pack contributes no URLs; its dependencies still load 393 * unless they are provided too. 394 * 395 * @param names Registered pack names. 396 * @return This object. 397 */ 398 public Builder providedPacks(String...names) { 399 providedPacks.addAll(Arrays.asList(names)); 400 return this; 401 } 402 403 /** 404 * Opts in to the startup WebJar check: the named packs (for example {@code "charts"}) are expanded through 405 * {@code dependsOn} and every WebJar they reach is probed when the mixin is built, so a missing 406 * {@code org.webjars.npm:echarts} fails at startup (E-70) instead of on the first chart page. An app pack 407 * registered with {@link #registerToolkitPack(ToolkitPack)} that depends on {@code "echarts"} opts in too. 408 * 409 * @param names Registered pack names. 410 * @return This object. 411 */ 412 public Builder requirePacks(String...names) { 413 requiredPacks.addAll(Arrays.asList(names)); 414 return this; 415 } 416 417 // Package-private: tests simulate an absent WebJar (the jar is on every test classpath). 418 Builder webJarProbe(UnaryOperator<String> probe) { 419 webJarProbe = rnn(probe); 420 return this; 421 } 422 423 /** 424 * Adds packs every card of a type requires, after the built-in one 425 * ({@code datatables} → {@code "datatables-glue"}). 426 * 427 * @param type The card type. 428 * @param packs Registered pack names. 429 * @return This object. 430 */ 431 public Builder cardRequires(String type, String...packs) { 432 cardRequirements.add(type, packs); 433 return this; 434 } 435 436 /** 437 * Registers a server-side card type handler for this mixin's {@code <@card>} directive, on top of 438 * {@link CardTypeRegistry#standard()}. 439 * 440 * <p> 441 * Most custom cards need only a JS handler; register a {@link CardTypeHandler} here when the server must 442 * validate or enrich the body. To also load toolkit packs for the type, use {@link #cardRequires(String, String...)}. 443 * 444 * @param handler The handler. Must not be <jk>null</jk>. 445 * @return This object. 446 * @throws IllegalArgumentException E-21 bad type name; E-22 reserved type; E-20 already registered. 447 */ 448 public Builder cardType(CardTypeHandler handler) { 449 cardTypes.add(handler); 450 return this; 451 } 452 453 /** 454 * Validates every page contract against {@code juneau-page.schema.json} when {@code <@console>} closes, and 455 * fails the render with E-14 on any finding. 456 * 457 * <p> 458 * Defaults to the {@code juneau.console.devMode} system property. Intended for development and tests; it parses 459 * and validates the contract on every render. 460 * 461 * <h4 class='section'>Example:</h4> 462 * <p class='bjava'> 463 * <ja>@Bean</ja> <jk>public</jk> FreemarkerMixin freemarker() { 464 * <jk>return</jk> ConsoleFreemarkerMixin.<jsm>create</jsm>().devMode(<jk>true</jk>).basePath(<js>"/templates/"</js>).build(); 465 * } 466 * </p> 467 * 468 * @param value Whether to validate. 469 * @return This object. 470 */ 471 public Builder devMode(boolean value) { 472 devMode = value; 473 return this; 474 } 475 476 /** 477 * Enables the {@code assetUrl(path)} template function that versions the adopter's own static assets. 478 * 479 * <p> 480 * {@code assetUrl('/js/app.js')} returns {@code /js/app.js?v=<crc32 of the bundled bytes>}, where the bytes are 481 * read once (and the token cached) from {@code resourceRoot + path} on {@code loader}. This is the adopter-side 482 * counterpart of Juneau's own {@code viewAssetUrl}/{@code consoleJsUrl}/{@code chromeCssUrl}/{@code themeAssetUrl} 483 * cache-busters, for files the servlet container's static handler serves. A path with a query string, a 484 * non-root-absolute path (e.g. an external URL), or a path naming no bundled resource is returned unchanged 485 * (the last also logs a warning in {@link #devMode(boolean) dev mode}). The URL path itself is never rewritten, 486 * so any context-path prefix must be added by the template. 487 * 488 * <h4 class='section'>Example:</h4> 489 * <p class='bjava'> 490 * <ja>@Bean</ja> <jk>public</jk> FreemarkerMixin freemarker() { 491 * <jk>return</jk> ConsoleFreemarkerMixin.<jsm>create</jsm>() 492 * .basePath(<js>"/templates/"</js>) 493 * .adopterAssets(getClass().getClassLoader(), <js>"static"</js>) <jc>// /js/app.js -> classpath static/js/app.js</jc> 494 * .build(); 495 * } 496 * </p> 497 * <p class='bftl'> 498 * <script src="${assetUrl('/js/app.js')}"></script> 499 * </p> 500 * 501 * @param loader The class loader that holds the assets. Must not be {@code null}. 502 * @param resourceRoot The classpath directory the URL paths are relative to (e.g. {@code "static"}); a leading 503 * and trailing slash are optional. Must not be {@code null}. 504 * @return This object. 505 */ 506 public Builder adopterAssets(ClassLoader loader, String resourceRoot) { 507 this.adopterLoader = rnn(loader); 508 this.adopterRoot = rnn(resourceRoot); 509 return this; 510 } 511 512 /** 513 * Builds the {@link ConsoleFreemarkerMixin}. 514 * 515 * <p> 516 * Overrides {@link org.apache.juneau.rest.server.view.freemarker.FreemarkerMixin.Builder#build() FreemarkerMixin.Builder#build()} — 517 * without this override, the inherited method would silently return a plain {@link FreemarkerMixin}, not 518 * a {@link ConsoleFreemarkerMixin}. 519 * 520 * @return A new {@link ConsoleFreemarkerMixin} instance. 521 */ 522 @Override 523 public ConsoleFreemarkerMixin build() { 524 return new ConsoleFreemarkerMixin(this); 525 } 526 } 527}