/* Ċ Ġ* ĠJ aval in Ġ- Ġhttps :// jav al in . io Ċ Ġ* ĠCopyright Ġ 2 0 1 7 ĠDavid ĠÃ ħ se Ċ Ġ* ĠLicensed Ġunder ĠApache Ġ 2 . 0 : Ġhttps :// github . com / tip sy / jav al in / blob / master / LICENSE Ċ Ġ*/ Ċ Ċ package Ġio . jav al in . plugin . rendering . template Ċ Ċ import Ġio . jav al in . core . util . Optional Dependency Ċ import Ġio . jav al in . core . util . Util Ċ import Ġio . jav al in . http . Context Ċ import Ġio . jav al in . plugin . rendering . File Renderer Ċ import Ġorg . apache . velocity . Velocity Context Ċ import Ġorg . apache . velocity . app . Velocity Engine Ċ import Ġjava . io . String Writer Ċ import Ġjava . nio . charset . StandardCharsets Ċ Ċ object ĠJ aval in Velocity Ġ: ĠFile Renderer Ġ{ ĊĊĠĠĠ Ġprivate Ġvar Ġvelocity Engine : ĠVe locity Engine ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġval Ġdefault Velocity Engine : ĠVe locity Engine Ġby Ġlazy Ġ{ Ġdefault Velocity Engine () Ġ} ĊĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġconfigure ( static Velocity Engine : ĠVe locity Engine ) Ġ{ ĊĠĠĠĠĠĠĠ Ġvelocity Engine Ġ= Ġstatic Velocity Engine ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġrender ( filePath : ĠString , Ġmodel : ĠMap < String , ĠAny ? >, Ġctx : ĠContext ?): ĠString Ġ{ ĊĠĠĠĠĠĠĠ ĠUtil . ensure Dependency Present ( Optional Dependency . VE LOC ITY ) ĊĠĠĠĠĠĠĠ Ġval Ġstring Writer Ġ= ĠString Writer () ĊĠĠĠĠĠĠĠ Ġ( velocity Engine Ġ?: Ġdefault Velocity Engine ). get Template ( filePath , ĠStandard Charsets . UTF _ 8 . name ()). merge ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠVe locity Context ( model . to Mutable Map ()), Ġstring Writer ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġreturn Ġstring Writer . toString () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdefault Velocity Engine () Ġ= ĠVe locity Engine (). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġset Property (" resource . loaders ", Ġ" class ") ĊĠĠĠĠĠĠĠ Ġset Property (" resource . loader . class . class ", Ġ" org . apache . velocity . runtime . resource . loader . Classpath Resource Loader ") ĊĠĠĠ Ġ} Ċ Ċ } Ċ