Class TemplateEngine
- All Implemented Interfaces:
MutinyDelegate
- Direct Known Subclasses:
FreeMarkerTemplateEngine
,HandlebarsTemplateEngine
,HTTLTemplateEngine
,JadeTemplateEngine
,MVELTemplateEngine
,PebbleTemplateEngine
,PugTemplateEngine
,RockerTemplateEngine
,ThymeleafTemplateEngine
Concrete implementations exist for several well-known template engines.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTemplateEngine
(io.vertx.ext.web.common.template.TemplateEngine delegate) TemplateEngine
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
io.vertx.ext.web.common.template.TemplateEngine
int
hashCode()
static TemplateEngine
newInstance
(io.vertx.ext.web.common.template.TemplateEngine arg) io.smallrye.mutiny.Uni<Buffer>
Render the template.io.smallrye.mutiny.Uni<Buffer>
Render the template.renderAndAwait
(io.vertx.core.json.JsonObject context, String templateFileName) Blocking variant ofrender(JsonObject,String)
.renderAndAwait
(Map<String, Object> context, String templateFileName) Blocking variant ofrender(Map,String)
.void
renderAndForget
(io.vertx.core.json.JsonObject context, String templateFileName) Variant ofrender(JsonObject,String)
that ignores the result of the operation.void
renderAndForget
(Map<String, Object> context, String templateFileName) Variant ofrender(Map,String)
that ignores the result of the operation.toString()
<T> T
unwrap()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
TemplateEngine
public TemplateEngine(io.vertx.ext.web.common.template.TemplateEngine delegate) -
TemplateEngine
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.common.template.TemplateEngine getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
render
@CheckReturnValue public io.smallrye.mutiny.Uni<Buffer> render(io.vertx.core.json.JsonObject context, String templateFileName) Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator. Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
renderAndAwait
Blocking variant ofrender(JsonObject,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use- Returns:
- the Buffer instance produced by the operation.
-
renderAndForget
Variant ofrender(JsonObject,String)
that ignores the result of the operation.This method subscribes on the result of
render(JsonObject,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromrender(JsonObject,String)
but you don't need to compose it with other operations.- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use
-
clearCache
public void clearCache() -
render
@CheckReturnValue public io.smallrye.mutiny.Uni<Buffer> render(Map<String, Object> context, String templateFileName) Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator. Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
renderAndAwait
Blocking variant ofrender(Map,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use- Returns:
- the Buffer instance produced by the operation.
-
renderAndForget
Variant ofrender(Map,String)
that ignores the result of the operation.This method subscribes on the result of
render(Map,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromrender(Map,String)
but you don't need to compose it with other operations.- Parameters:
context
- the routing contexttemplateFileName
- the template file name to use
-
unwrap
public <T> T unwrap()- Returns:
- the engine instance.
-
newInstance
-