|
From: <jue...@we...> - 2004-11-19 14:45:15
|
No problem, in principle - but why do you need to access the = "cacheTemplate" property in the first place? It should only really be of = interest in the VelocityView class itself, not in custom subclasses... =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Roberto Cosenza Gesendet: Fr 19.11.2004 13:29 An: spr...@li... Betreff: [Springframework-developer] Subclassing VelocityView Hi. I'm writing a custom VelocityView and I need to access the cacheTemplate property. Unfortunately this is private and there is no protected/public getter. Hope somebody fixes this in a future release. -- Roberto Cosenza Infoflex Connect AB, Sweden Tel: +46-(0)8-55576860, Fax: +46-(0)8-55576861 -- Nordic Messaging Technologies is a trademark of Infoflex Connect. Please visit www.nordicmessaging.se for more information about our carrier-grade messaging products. ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: <jue...@we...> - 2004-11-19 15:23:41
|
OK, I see. I'll add an "isCacheTemplate" getter. Do you have any other = suggestions on how to improve VelocityView in terms of easy subclassing? =20 Juergen =20 ________________________________ Von: spr...@li... im Auftrag = von Roberto Cosenza Gesendet: Fr 19.11.2004 16:00 An: spr...@li... Betreff: Re: [Springframework-developer] Subclassing VelocityView j=FCrgen h=F6ller [werk3AT] wrote: >No problem, in principle - but why do you need to access the = "cacheTemplate" property in the first place? It should only really be of = interest in the VelocityView class itself, not in custom subclasses... > >Juergen >=20 > I'm writing a special kind of view which is based on merging two or more velocity templates before rendering the output. I need the value of "cacheTemplate" to see if I need to cache the extra templates. /Roberto ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Roberto C. <ro...@in...> - 2004-11-19 22:32:07
|
Yes,
a) I would refactor the method renderMergedTemplateModel extracting the c=
ode
that puts in the Context the different formatters and tools.
Of course, I'd make it protected in order to be overridden.
b) mergeTemplate should not take the Template argument. Template is an
instance variable, so it doesn't need to be passed in.
It could be renamed into "mergeContext" instead. In this way one coul=
d
use the context the merge more than one templates as in my case nicely.
Hope I made clear my ideas and that they make sense to you all.
/robcos
----- Original Message -----
From: "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>
To: <spr...@li...>
Sent: Friday, November 19, 2004 4:25 PM
Subject: Re: [Springframework-developer] Subclassing VelocityView
OK, I see. I'll add an "isCacheTemplate" getter. Do you have any other
suggestions on how to improve VelocityView in terms of easy subclassing?
Juergen
|
|
From: <jue...@we...> - 2004-11-21 19:43:46
|
Good suggestions! Actually, an "exposeToolAttributes" method has already =
been factored out since 1.1.2.
=20
I've also implemented your second suggestion: a factored out =
"doRender(Context, HttpServletResponse)" method that determines the =
template instance via the "url" bean property and delegates to the =
existing "mergeTemplate" method for the actual merging of template and =
Velocity context.
=20
"mergeTemplate" needs the template parameter because we support fresh =
fetching of the template instance from the VelocityEngine for each =
rendering. The VelocityEngine itself will cache the template, so this is =
a viable strategy. If turning the "cacheTemplate" property to "true", =
VelocityView itself will cache the template instance too (which is =
slightly more efficient than Velocity's own caching, but doesn't check =
whether the template file has changed).
=20
In your case, you should be able to override "doRender" and call =
"mergeTemplate" for each of the templates that you want to render. The =
template model will already be complete when passed into "doRender", so =
should not need to worry about exposing the helpers and tool attributes.
=20
Please have a look at the current version of VelocityView in CVS and =
check whether it meets your needs! I'll commit it promptly, so it should =
be visible in public CVS by tomorrow morning at the latest.=20
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Roberto Cosenza
Gesendet: Fr 19.11.2004 23:31
An: spr...@li...
Betreff: Re: [Springframework-developer] Subclassing VelocityView
Yes,
a) I would refactor the method renderMergedTemplateModel extracting the =
code
that puts in the Context the different formatters and tools.
Of course, I'd make it protected in order to be overridden.
b) mergeTemplate should not take the Template argument. Template is an
instance variable, so it doesn't need to be passed in.
It could be renamed into "mergeContext" instead. In this way one =
could
use the context the merge more than one templates as in my case nicely.
Hope I made clear my ideas and that they make sense to you all.
/robcos
----- Original Message -----
From: "j=FCrgen h=F6ller [werk3AT]" <jue...@we...>
To: <spr...@li...>
Sent: Friday, November 19, 2004 4:25 PM
Subject: Re: [Springframework-developer] Subclassing VelocityView
OK, I see. I'll add an "isCacheTemplate" getter. Do you have any other
suggestions on how to improve VelocityView in terms of easy subclassing?
Juergen
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: <ro...@in...> - 2004-11-23 00:11:09
|
Very good Juergen. I checked out cvs and looks ok to me. Thanx for your great work on Spring. /rob On Sun, Nov 21, 2004 at 07:26:44PM +0100, j=FCrgen h=F6ller [werk3AT] wro= te: > Please have a look at the current version of VelocityView in CVS and ch= eck whether it meets your needs! I'll commit it promptly, so it should be= visible in public CVS by tomorrow morning at the latest.=20 > =20 > Juergen |
|
From: Roberto C. <rob...@in...> - 2004-11-19 15:00:13
|
j=FCrgen h=F6ller [werk3AT] wrote: >No problem, in principle - but why do you need to access the "cacheTempl= ate" property in the first place? It should only really be of interest in= the VelocityView class itself, not in custom subclasses... >=20 >Juergen > =20 > I'm writing a special kind of view which is based on merging two or more=20 velocity templates before rendering the output. I need the value of=20 "cacheTemplate" to see if I need to cache the extra templates. /Roberto |