Package org.apache.juneau.rest.server.view.mustache
juneau-rest-server-view-mustache module.
Provides three sibling pieces that together let a Juneau REST resource render Mustache templates via mustache.java:
MustacheMixin— mixin that renders raw Mustache templates from the importer's classpath under/mustache/*and auto-registersMustacheViewRenderer.MustacheView— immutable value class (implements the coreViewinterface) returned from@RestOpmethods to ask the framework to render a Mustache template.MustacheViewRenderer—ResponseProcessorthat detectsMustacheViewreturns and dispatches them to the configuredMustacheFactoryviafactory.compile(templateName).execute(writer, scope).
Composition example (microservice):
Engine-agnostic packaging:
The bridge module's main POM declares only
com.github.spullara.mustache.java:compiler in provided scope — no
concrete Mustache transitive dep ships here. Consumers add the engine matching their
deployment:
- Juneau microservice / Jetty / Spring Boot: add
com.github.spullara.mustache.java:compiler. With no user-supplied factory bean, the bridge builds a defaultMustacheFactoryon first request anchored on the importer's classpath under the configured base path. - Custom: register your own
@Bean MustacheFactorywith whatever resolvers, object handlers, and encoders you need.
When no Mustache engine is on the classpath, the renderer surfaces a clear diagnostic naming
the missing dependency and linking to the "Choosing a MustacheFactory" matrix in
MustacheViewSupport.md.
Note on Spring Boot's mustache starter:
Spring Boot's spring-boot-starter-mustache pulls in com.samskivert:jmustache
(a separate Mustache implementation), not mustache.java. The bridge is mustache.java-
specific; consumers who want to use jmustache instead supply their own
ResponseProcessor rather than
MustacheViewRenderer.
See Also:
- Since:
- 10.0.0
-
ClassesClassDescriptionFlavor-neutral worker bean carrying the Mustache raw-template-dispatch logic shared by the
MustacheMixinmixin, theMustacheServletservlet, and theMustacheResourcechild flavors.Builder forMustacheDispatcher.Mixin that wires Mustache view-rendering onto any Juneau REST resource.Builder forMustacheMixin.Child-resource flavor of theMustacheMixinmixin.Standalone servlet companion of theMustacheMixinmixin.Immutable value class returned from@RestOp-annotated methods to ask the framework to render a Mustache template.ResponseProcessorthat detectsMustacheView-typed return values and asks the configuredMustacheFactoryto render them directly onto the response writer.