Usage of ToolManager
Stefan Großhauser <[email protected]> Thu, 27 Jan 2022 06:38:13 +0100
| Newsgroups | gmane.comp.jakarta.velocity.user |
|---|---|
| Message-ID | <[email protected]> |
--=-RINC7LybzfQXjhVV0gNy Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello everone=2C I am sorry that I have yet another question=2E I would like to use some of the Standard Tools https=3A//velocity=2Eapache=2Eorg/tools/3=2E1/tools-summary=2Ehtml =2E =28By the way=2C it has not become clear to me=2C what the relationship bet= ween Standard Tools and Generic Tools is=2E=29 This example https=3A//velocity=2Eapache=2Eorg/tools/3=2E1/standalone=2Ehtml and this one https=3A//github=2Ecom/apache/maven-doxia-sitetools/commit/0abee78da740501f= c0584f65e06c1007229f58d6 suggest to me that all I have to do to access Tools like =24esc=2C =24displ= ay or =24context is to replace -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VelocityContext context =3D new= VelocityContext=28=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VelocityEngine ve =3D new Veloc= ityEngine=28=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ToolManager manager =3D new Too= lManager=28true=2C true=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 manager=2EsetVelocityEngine=28v= e=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 logger=2Edebug=28=22hasApplicat= ionTools=3A =7B=7D=22=2C manager=2EhasApplicationTools=28=29=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 logger=2Edebug=28=22hasRequestT= ools=3A =7B=7D=22=2C manager=2EhasRequestTools=28=29=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Context context =3D manager=2Ec= reateContext=28=29=3B But using this context=2C the hasApplicationTools=28=29 and hasRequestTools= =28=29 functions return false and e=2Eg=2E there is no =24context available= to the template=3A 06=3A26=3A53=2E292 =5Bmain=5D DEBUG o=2Eapache=2Evelocity=2Etools=2EToolMan= ager - VelocityEngine instance was changed to org=2Eapache=2Evelocity=2Eapp= =2EVelocityEngine=4070a9f84e 06=3A26=3A53=2E293 =5Bmain=5D DEBUG d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - hasApplicationTools=3A false 06=3A26=3A53=2E294 =5Bmain=5D DEBUG d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - hasRequestTools=3A false 06=3A26=3A53=2E297 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Initializing= Velocity=2C Calling init=28=29=2E=2E=2E 06=3A26=3A53=2E298 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Starting Apac= he Velocity v2=2E3 06=3A26=3A53=2E302 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Default Prope= rties resource=3A org/apache/velocity/runtime/defaults/velocity=2Epropertie= s 06=3A26=3A53=2E333 =5Bmain=5D DEBUG VelocityEngine - ResourceLoader instant= iated=3A org=2Eapache=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathR= esourceLoader 06=3A26=3A53=2E340 =5Bmain=5D DEBUG VelocityEngine - initialized =28class o= rg=2Eapache=2Evelocity=2Eruntime=2Eresource=2EResourceCacheImpl=29 with cla= ss java=2Eutil=2ECollections=24SynchronizedMap cache map=2E 06=3A26=3A53=2E347 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EStop 06=3A26=3A53=2E351 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EDefine 06=3A26=3A53=2E354 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EBreak 06=3A26=3A53=2E357 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EEvaluate 06=3A26=3A53=2E360 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EMacro 06=3A26=3A53=2E366 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EParse 06=3A26=3A53=2E370 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EInclude 06=3A26=3A53=2E374 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EForeach 06=3A26=3A53=2E422 =5Bmain=5D DEBUG VelocityEngine=2Eparser - Created =2720= =27 parsers=2E 06=3A26=3A53=2E461 =5Bmain=5D DEBUG VelocityEngine=2Emacro - =22velocimacro= =2Elibrary=2Epath=22 is not set=2E Trying default library=3A velocimacros= =2Evtl 06=3A26=3A53=2E463 =5Bmain=5D DEBUG VelocityEngine=2Eloader=2Eclass - Could= not load resource =27velocimacros=2Evtl=27 from ResourceLoader org=2Eapach= e=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathResourceLoader 06=3A26=3A53=2E465 =5Bmain=5D DEBUG VelocityEngine=2Emacro - Default librar= y velocimacros=2Evtl not found=2E Trying old default library=3A VM=5Fglobal= =5Flibrary=2Evm 06=3A26=3A53=2E467 =5Bmain=5D DEBUG VelocityEngine=2Eloader=2Eclass - Could= not load resource =27VM=5Fglobal=5Flibrary=2Evm=27 from ResourceLoader org= =2Eapache=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathResourceLoade= r 06=3A26=3A53=2E468 =5Bmain=5D DEBUG VelocityEngine=2Emacro - Old default li= brary VM=5Fglobal=5Flibrary=2Evm not found=2E 06=3A26=3A53=2E469 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInline=20= =3D true=3A VMs can be defined inline in templates 06=3A26=3A53=2E470 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInlineToO= verride =3D false=3A VMs defined inline may NOT replace previous VM definit= ions 06=3A26=3A53=2E471 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInlineLoc= al =3D false=3A VMs defined inline will be global in scope if allowed=2E 06=3A26=3A53=2E472 =5Bmain=5D DEBUG VelocityEngine=2Emacro - autoload off= =3A VM system will not automatically reload global library macros 06=3A26=3A53=2E528 =5Bmain=5D DEBUG VelocityEngine=2Eloader - ResourceManag= er=3A found velocity/reflection=2Evm with loader org=2Eapache=2Evelocity=2E= runtime=2Eresource=2Eloader=2EClasspathResourceLoader 06=3A26=3A53=2E531 =5Bmain=5D ERROR VelocityEngine=2Erendering - Variable= =24context has not been set at velocity/reflection=2Evm=5Bline 9=2C column= 19=5D 06=3A26=3A53=2E538 =5Bmain=5D ERROR d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - something invoked in the template threw an exception org=2Eapache=2Evelocity=2Eexception=2EMethodInvocationException=3A Variable= =24context has not been set at velocity/reflection=2Evm=5Bline 9=2C column= 19=5D =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2EgetRootVariableValue=28ASTReference= =2Ejava=3A1160=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2Eexecute=28ASTReference=2Ejava=3A309= =29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2Evalue=28ASTReference=2Ejava=3A704=29= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Edirective=2EForeach=2Erender=28Foreach=2Ejava=3A237=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTDirective=2Erender=28ASTDirective=2Ejava=3A304=29= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2ESimpleNode=2Erender=28SimpleNode=2Ejava=3A439=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2ETem= plate=2Emerge=28Template=2Ejava=3A358=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2ETem= plate=2Emerge=28Template=2Ejava=3A262=29 Then I tried to include some more explicit configuration=2C to enable these= tools or tool scopes =28I am not sure which=29=3A -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VelocityContext context =3D new= VelocityContext=28=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 VelocityEngine ve =3D new Veloc= ityEngine=28=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 EasyFactoryConfiguration config= =3D new EasyFactoryConfiguration=28=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 config=2Etoolbox=28Scope=2EREQU= EST=29=2Eproperty=28=22locale=22=2C Locale=2EGERMAN=29 +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =2Etool=28DateTool=2Eclas= s=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 config=2Etoolbox=28Scope=2EAPPL= ICATION=29 +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =2Etool=28NumberTool=2Ecl= ass=29=2Eproperty=28=22locale=22=2C Locale=2EGERMAN=29=3B + +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ToolManager manager =3D new Too= lManager=28true=2C true=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 manager=2Econfigure=28config=29= =3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 manager=2EsetVelocityEngine=28v= e=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 logger=2Edebug=28=22hasApplicat= ionTools=3A =7B=7D=22=2C manager=2EhasApplicationTools=28=29=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 logger=2Edebug=28=22hasRequestT= ools=3A =7B=7D=22=2C manager=2EhasRequestTools=28=29=29=3B +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Context context =3D manager=2Ec= reateContext=28=29=3B This makes hasApplicationTools=28=29 and hasRequestTools=28=29 return true= =2C but still in the template=2C there is no =24context or =24esc or =24dis= play available=2E 06=3A30=3A28=2E071 =5Bmain=5D DEBUG o=2Eapache=2Evelocity=2Etools=2EToolMan= ager - VelocityEngine instance was changed to org=2Eapache=2Evelocity=2Eapp= =2EVelocityEngine=406b67034 06=3A30=3A28=2E072 =5Bmain=5D DEBUG d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - hasApplicationTools=3A true 06=3A30=3A28=2E074 =5Bmain=5D DEBUG d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - hasRequestTools=3A true 06=3A30=3A28=2E082 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Initializing= Velocity=2C Calling init=28=29=2E=2E=2E 06=3A30=3A28=2E083 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Starting Apac= he Velocity v2=2E3 06=3A30=3A28=2E089 =5Bmain=5D DEBUG org=2Eapache=2Evelocity - Default Prope= rties resource=3A org/apache/velocity/runtime/defaults/velocity=2Epropertie= s 06=3A30=3A28=2E111 =5Bmain=5D DEBUG VelocityEngine - ResourceLoader instant= iated=3A org=2Eapache=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathR= esourceLoader 06=3A30=3A28=2E117 =5Bmain=5D DEBUG VelocityEngine - initialized =28class o= rg=2Eapache=2Evelocity=2Eruntime=2Eresource=2EResourceCacheImpl=29 with cla= ss java=2Eutil=2ECollections=24SynchronizedMap cache map=2E 06=3A30=3A28=2E123 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EStop 06=3A30=3A28=2E128 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EDefine 06=3A30=3A28=2E131 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EBreak 06=3A30=3A28=2E135 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EEvaluate 06=3A30=3A28=2E138 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EMacro 06=3A30=3A28=2E145 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EParse 06=3A30=3A28=2E150 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EInclude 06=3A30=3A28=2E154 =5Bmain=5D DEBUG VelocityEngine - Loaded System Directiv= e=3A org=2Eapache=2Evelocity=2Eruntime=2Edirective=2EForeach 06=3A30=3A28=2E208 =5Bmain=5D DEBUG VelocityEngine=2Eparser - Created =2720= =27 parsers=2E 06=3A30=3A28=2E264 =5Bmain=5D DEBUG VelocityEngine=2Emacro - =22velocimacro= =2Elibrary=2Epath=22 is not set=2E Trying default library=3A velocimacros= =2Evtl 06=3A30=3A28=2E267 =5Bmain=5D DEBUG VelocityEngine=2Eloader=2Eclass - Could= not load resource =27velocimacros=2Evtl=27 from ResourceLoader org=2Eapach= e=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathResourceLoader 06=3A30=3A28=2E268 =5Bmain=5D DEBUG VelocityEngine=2Emacro - Default librar= y velocimacros=2Evtl not found=2E Trying old default library=3A VM=5Fglobal= =5Flibrary=2Evm 06=3A30=3A28=2E272 =5Bmain=5D DEBUG VelocityEngine=2Eloader=2Eclass - Could= not load resource =27VM=5Fglobal=5Flibrary=2Evm=27 from ResourceLoader org= =2Eapache=2Evelocity=2Eruntime=2Eresource=2Eloader=2EClasspathResourceLoade= r 06=3A30=3A28=2E273 =5Bmain=5D DEBUG VelocityEngine=2Emacro - Old default li= brary VM=5Fglobal=5Flibrary=2Evm not found=2E 06=3A30=3A28=2E274 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInline=20= =3D true=3A VMs can be defined inline in templates 06=3A30=3A28=2E275 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInlineToO= verride =3D false=3A VMs defined inline may NOT replace previous VM definit= ions 06=3A30=3A28=2E276 =5Bmain=5D DEBUG VelocityEngine=2Emacro - allowInlineLoc= al =3D false=3A VMs defined inline will be global in scope if allowed=2E 06=3A30=3A28=2E277 =5Bmain=5D DEBUG VelocityEngine=2Emacro - autoload off= =3A VM system will not automatically reload global library macros 06=3A30=3A28=2E336 =5Bmain=5D DEBUG VelocityEngine=2Eloader - ResourceManag= er=3A found velocity/reflection=2Evm with loader org=2Eapache=2Evelocity=2E= runtime=2Eresource=2Eloader=2EClasspathResourceLoader 06=3A30=3A28=2E339 =5Bmain=5D ERROR VelocityEngine=2Erendering - Variable= =24context has not been set at velocity/reflection=2Evm=5Bline 9=2C column= 19=5D 06=3A30=3A28=2E346 =5Bmain=5D ERROR d=2Eh=2Eetiketten=2EVelocityTemplateEng= ine - something invoked in the template threw an exception org=2Eapache=2Evelocity=2Eexception=2EMethodInvocationException=3A Variable= =24context has not been set at velocity/reflection=2Evm=5Bline 9=2C column= 19=5D =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2EgetRootVariableValue=28ASTReference= =2Ejava=3A1160=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2Eexecute=28ASTReference=2Ejava=3A309= =29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTReference=2Evalue=28ASTReference=2Ejava=3A704=29= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Edirective=2EForeach=2Erender=28Foreach=2Ejava=3A237=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2EASTDirective=2Erender=28ASTDirective=2Ejava=3A304=29= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2Erun= time=2Eparser=2Enode=2ESimpleNode=2Erender=28SimpleNode=2Ejava=3A439=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2ETem= plate=2Emerge=28Template=2Ejava=3A358=29 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 at org=2Eapache=2Evelocity=2ETem= plate=2Emerge=28Template=2Ejava=3A262=29 The lib versions are implementation =28=27org=2Eapache=2Evelocity=3Avelocity-engine-core=3A2=2E3= =27=29 implementation =28=27org=2Eapache=2Evelocity=2Etools=3Avelocity-tools-gener= ic=3A3=2E1=27=29 I have no more ideas now=2E Maybe somebody can point me out what is going o= n here and how ToolManager is meant to be used=3F - If I may mention that=3A The code listings on page https=3A//velocity=2Eapache=2Eorg/tools/3=2E1/generic=2Ehtml have not helped me much=3A A Map is initialised=2C but never used=2E Argume= nts are passed=2C but not defined=2E Thank you very much for any advice=2E Stefan =20 JETZT NEWSLETTER ABONNIEREN=3A https=3A//hammerbacher=2Ecom/newsletter-anme= ldung/ Hammerbacher GmbH Gesch=C3=A4ftsf=C3=BChrer Bernhard Hammerbacher=2C Ursula= Hammerbacher Registergericht N=C3=BCrnberg HRB 10908 =20 =09Hausanschrift Daimlerstra=C3=9Fe 4-6 D 92318 Neumarkt =09Telefon +49=280=299181 2592-0 =09Telefax +49=280=299181 2592-28 =09E-Mail info=40hammerbachergmbh=2Ede www=2Ehammerbacher=2Ecom =20 Haftungsausschluss / Disclaimer=20 Die Informationen=2C die in dieser Kommunikation enthalten sind=2C sind aus= schlie=C3=9Flich und allein f=C3=BCr den Empf=C3=A4nger bestimmt=2E Die Ver= wendung durch Dritte ist untersagt=2E Die Firma Hammerbacher GmbH ist nur f= =C3=BCr die von ihr eingegeben Informationen verantwortlich=2C jedoch nicht= f=C3=BCr die einwandfreie =C3=9Cbertragung oder im Zusammenhang mit der=20= =C3=9Cbertragung oder dem Empfang eingetretene Ver=C3=A4nderungen oder Verz= =C3=B6gerungen=2E Diese E-Mail enth=C3=A4lt vetrtrauliche und/oder rechtlich gesch=C3=BCtzte= Informationen=2E Wenn Sie nicht der richtige Adressat sind oder diese E-Ma= il irrt=C3=BCmlich erhalten=C2=A0 haben=2C informieren Sie bitte sofort den= Absender und vernichten Sie diese E-Mail=2E Das unerlaubte Kopieren sowie= die unbefugte Weitergabe dieser Mail ist nicht gestattet=2E --=-RINC7LybzfQXjhVV0gNy--