velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <Christoph.R...@dlr.de>
Subject Re: [Proposed] changes to VelocityServlet
Date Thu, 01 Mar 2001 15:25:25 GMT
"Geir Magnusson Jr." wrote:
> 
> Opinions :
> 
> 1) I think we should change the error() method from private final to
> protected.  That way, a derived class can do the error handling and do
> something useful (log, send email, panic...).   Currently it just spews
> some HTML.
> 
> 2)  I would like to change init() to turn the properties file into a
> j.u.Properties, and then pass that to a routine :
> 
>   protected void alterInitProps( ServletConfig config, Properties props
> )
> 

+1, but use a nicer name, e.g. prepareProperties.

I have a counter suggestion: make the properties loading an overridable
method:

  ...
  Properties p = new loadProperties(propsFilename);
  Runtime.init( p );
  ...
  protected Properties loadProperties( propsFilename )
  {
    Properties p = new Properties();
    p.load(propsFilename);
    return p;
  }

In this way you can do fancy setup, merge you own stuff in, etc.
Your subclass would just do:
  protected Properties loadProperties( propsFilename )
  {
    Properties p = super.loadProperties(propsFilename);
    ... do you stuff here
  }
 
:) Chirstoph

Mime
View raw message