Hi all! :-)

Do you have any plans for getting rid of the static usage of Velocity inside Velocity*Servlet classes?

So instead of this:
public class VelocityViewServlet extends HttpServlet
{
    public void init(ServletConfig config) throws ServletException
    {
        //...
        Velocity.init();
        //...
    }

    //...

    public Template getTemplate(String name)
        throws ResourceNotFoundException, ParseErrorException, Exception
    {
        return RuntimeSingleton.getTemplate(name);
    }
}

you could do something like this:
public class VelocityViewServlet extends HttpServlet
{
    private VelocityEngine ve = ...;
    public void init(ServletConfig config) throws ServletException
    {
        //...
        ve.init();
        //...
    }

    //...

    public Template getTemplate(String name)
        throws ResourceNotFoundException, ParseErrorException, Exception
    {
        return ve.getTemplate(name);
    }
}

Why do I want to change the behaviour? Because the current implementation breaks if Velocity classes are loaded to a common classloader and then several webapps try to use it...
As it is static, it gets initialized only once and then only the first webapp will work, all others will usually fail to find their templates and will have other similar issues...


Or is there some other way out of this?

Thanks,
Neeme


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to