Package io.micronaut.views.soy
Class SoySauceViewsRenderer<T>
java.lang.Object
io.micronaut.views.soy.SoySauceViewsRenderer<T>
- Type Parameters:
T
- The model type
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,ViewsRenderer<T,
io.micronaut.http.HttpRequest<?>>
@Requires(classes=com.google.template.soy.jbcsrc.api.SoySauce.class) @Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
public class SoySauceViewsRenderer<T>
extends Object
implements ViewsRenderer<T,io.micronaut.http.HttpRequest<?>>
Renders views with a Soy engine.
- Since:
- 1.2.1
- Author:
- Sam Gammon (sam@bloombox.io)
-
Field Summary
Modifier and TypeFieldDescriptionprotected final SoyNamingMapProvider
protected final SoyViewsRendererConfigurationProperties
protected final com.google.template.soy.jbcsrc.api.SoySauce
protected final ViewsConfiguration
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionSoySauceViewsRenderer
(ViewsConfiguration viewsConfiguration, @Nullable CspConfiguration cspConfiguration, @Nullable SoyNamingMapProvider namingMapProvider, SoyViewsRendererConfigurationProperties soyConfiguration) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Field Details
-
viewsConfiguration
-
soyMicronautConfiguration
-
namingMapProvider
-
soySauce
protected final com.google.template.soy.jbcsrc.api.SoySauce soySauce
-
-
Constructor Details
-
SoySauceViewsRenderer
@Inject public SoySauceViewsRenderer(ViewsConfiguration viewsConfiguration, @Nullable @Nullable CspConfiguration cspConfiguration, @Nullable @Nullable SoyNamingMapProvider namingMapProvider, SoyViewsRendererConfigurationProperties soyConfiguration) - Parameters:
viewsConfiguration
- Views configuration properties.cspConfiguration
- Content-Security-Policy configuration.namingMapProvider
- Soy naming map providersoyConfiguration
- Soy configuration properties.
-
-
Method Details
-
render
@NonNull public @NonNull io.micronaut.core.io.Writable render(@NonNull @NonNull String viewName, @Nullable T data, @Nullable @Nullable io.micronaut.http.HttpRequest<?> request) - Specified by:
render
in interfaceViewsRenderer<T,
io.micronaut.http.HttpRequest<?>> - Parameters:
viewName
- view name to be rendereddata
- response body to render it with a viewrequest
- HTTP request- Returns:
- A writable where the view will be written to.
-
exists
- Specified by:
exists
in interfaceViewsRenderer<T,
io.micronaut.http.HttpRequest<?>> - Parameters:
view
- view name to be rendered- Returns:
- true if a template can be found for the supplied view name.
-