Package io.micronaut.views.velocity
Class VelocityViewsRenderer<T,R>
java.lang.Object
io.micronaut.views.velocity.VelocityViewsRenderer<T,R>
- Type Parameters:
T
- The model typeR
- The request type
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,ViewsRenderer<T,
R>
Renders with templates with Apache Velocity Project.
- Since:
- 1.0
- Author:
- Sergio del Amo, graemerocher
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final VelocityViewsRendererConfiguration
protected final org.apache.velocity.app.VelocityEngine
protected final ViewsConfiguration
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionVelocityViewsRenderer
(ViewsConfiguration viewsConfiguration, VelocityViewsRendererConfiguration velocityConfiguration, org.apache.velocity.app.VelocityEngine velocityEngine) -
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
-
velocityEngine
protected final org.apache.velocity.app.VelocityEngine velocityEngine -
viewsConfiguration
-
velocityConfiguration
-
folder
-
-
Constructor Details
-
VelocityViewsRenderer
@Inject public VelocityViewsRenderer(ViewsConfiguration viewsConfiguration, VelocityViewsRendererConfiguration velocityConfiguration, org.apache.velocity.app.VelocityEngine velocityEngine) - Parameters:
viewsConfiguration
- Views ConfigurationvelocityConfiguration
- Velocity ConfigurationvelocityEngine
- Velocity Engine
-
-
Method Details
-
render
@NonNull public @NonNull io.micronaut.core.io.Writable render(@NonNull @NonNull String view, @Nullable T data, @NonNull R request) - Specified by:
render
in interfaceViewsRenderer<T,
R> - Parameters:
view
- 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.
-
render
public void render(@NonNull @NonNull String view, org.apache.velocity.VelocityContext context, String encoding, Writer writer) - Parameters:
view
- The viewcontext
- The contextencoding
- The encodingwriter
- The writer
-
exists
- Specified by:
exists
in interfaceViewsRenderer<T,
R> - Parameters:
viewName
- view name to be rendered- Returns:
- true if a template can be found for the supplied view name.
-