velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sato tadayosi <>
Subject Re: how to inherit ServletToolboxManager?
Date Wed, 05 Jan 2005 14:48:33 GMT
Hi Kawai san,

Thank you for your advice!

 >>Now I need to use some my own implementation of ServletToolboxRuleSet
 >>(which is in "" package),
 >>so I tried to extend ServletToolboxManager to overrride "getRuleSet()"
 >>method in it. But I couldn't because ServletToolboxManager is singleton
 >>and its only constructor is private.
 > It is so easy to change the constructor protected.  ;)

Yes, actually I can by modifying the original ServletToolboxManager
source code because source is open, and then I can successfully subclass it.
But now I intend to let the original code unmodified, because I want
to let my library be used as an extension of Velocity View.
Primary reasons are:
  - I don't want to release my version of Velocity View
  - to reuse the original impl. as much as possible in order to
      easily follow the upgrades.

So far, I chose a solution to just copy the ServletToolboxManager source
and customize it to make my own ServletToolboxManager extention. But I think
it's not good solution... Now I'm looking for a better way.

> Hacking VelocityViewServlet#initToolbox()?  Actually, I think it might
> be nice if you could configure the RuleSet via init-param.

Yes, I hacked initToolbox(). And I don't think it might be solution
to configure the RuleSet via init-param. (I'm not good skilled, so
this might be wrong)

The real story is: my aim is to hack the mechanism of instance
creation of ViewTools and attach some additional function (such as
dependency injection) at the instance creation time. So I found
that I need to prepare replacements for all classes of
VelocityViewServlet, ServletToolboxManager, ServletToolboxRuleSet
and ServletToolInfo in my library.

I would really appreciate if you would give me another comment.
Thank you very much.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message