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 Details

  • 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 provider
      soyConfiguration - 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 interface ViewsRenderer<T,io.micronaut.http.HttpRequest<?>>
      Parameters:
      viewName - view name to be rendered
      data - response body to render it with a view
      request - HTTP request
      Returns:
      A writable where the view will be written to.
    • exists

      public boolean exists(@NonNull @NonNull String view)
      Specified by:
      exists in interface ViewsRenderer<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.