OpenSAML dependency on Velocity breaks application
Brent Putman
putmanb at georgetown.edu
Tue May 1 23:07:24 BST 2012
On 5/1/12 3:21 PM, Tom van den Berge wrote:
> Hi,
>
> After doing some research, I found that there is a way to use multiple
> instances of Velocity. It's actually pretty simple. It is explained
> here: http://velocity.apache.org/engine/releases/velocity-1.7/developer-guide.html#separate
>
>
You know, we actually already use injected instances of VelocityEngine
on the things that use Velocity templates. We actually don't ever use
what they call there the "singleton model". So to be honest, I'm not
actually sure why we are doing the global Velocity static init like
that. It might be that newly created VelocityEngine instances just
inherit the properties from the global Velocity singleton if they are
otherwise unspecified, so maybe that is the (not very good) reason. If
that is the case, we can probably just get rid of the Velocity singleton
init entirely, and just make sure to move those properties into the
Velocity Engine instance that is used in the encoders by, for example,
the Shibboleth IdP.
I'll do some more research to confirm. If accurate, I believe we might
be able to do that in a patch release, as it involves no interface
additions or changes.
Of course, not to point out the obvious, but I believe your app could
also do the same thing, and avoid being stepped on by the current
behavior of OpenSAML, by using the "separate instance model". As a
short-term workaround.
>
> Unfortunately overriding initializeVelocity doesn't work since it is a
> static method, so the only option seems to be to override bootstrap()
> and leave out the initializeVelocity() method. Sadly, this also means
> that the static String[] xmlToolingsConfigs must be copied.
Yeah, you're right. Java static methods can't be overridden. I
probably knew this at one point and just forgot. ;-) I thought we were
doing this in a test bootstrap for our unit tests, but turns out it's
not really inheritance we were doing. I was misremembering.
More information about the dev
mailing list