I think it's backwards compatible :)

+1


On 2/6/02 6:28 PM, "Daniel Rall" <[EMAIL PROTECTED]> wrote:

> The following patch makes configuring a bevy of VelocityServlet
> subclasses much easier, allowing the path to the velocity.properties
> file to be defined once for the entire context (or defined as a fall
> back for the case where no servlet-specific velocity.properties path
> is defined).  I'll go ahead and commit this if no one has any problems
> with it.
> 
> Dan
> 
> 
> Index: VelocityServlet.java
> ===================================================================
> RCS file: 
> /home/cvs/jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServle
> t.java,v
> retrieving revision 1.43
> diff -u -u -r1.43 VelocityServlet.java
> --- VelocityServlet.java    7 Dec 2001 00:01:55 -0000    1.43
> +++ VelocityServlet.java    6 Feb 2002 23:25:52 -0000
> @@ -248,11 +248,11 @@
>     *  VelocityServlet.INIT_PROPS_KEY, which should be a file containing
>     *  the configuration information.
>     *  <br><br>
> -     *  To configure your Servlet Spec 2.2 compliant servlet runner to pass
> this
> -     *  to you, put the following in your WEB-INF/web.xml file
> +     *  To configure your Servlet Spec 2.2 compliant servlet runner to pass
> +     *  this to you, put the following in your WEB-INF/web.xml file
>     *  <br>
>     *  <pre>
> -     *    &lt;servlet &gt;
> +     *    &lt;servlet&gt;
>     *      &lt;servlet-name&gt; YourServlet &lt/servlet-name&gt;
>     *      &lt;servlet-class&gt; your.package.YourServlet
> &lt;/servlet-class&gt;
>     *      &lt;init-param&gt;
> @@ -261,6 +261,17 @@
>     *      &lt;/init-param&gt;
>     *    &lt;/servlet&gt;
>     *   </pre>
> +     *
> +     * Alternately, if you wish to configure an entire context in this
> +     * fashion, you may use the following:
> +     *  <br>
> +     *  <pre>
> +     *    &lt;context-param&gt;
> +     *       &lt;param-name&gt; properties &lt;/param-name&gt;
> +     *       &lt;param-value&gt; velocity.properties &lt;/param-value&gt;
> +     *       &lt;description&gt; Path to Velocity configuration
> &lt;/description&gt;
> +     *    &lt;/context-param&gt;
> +     *   </pre>
>     * 
>     *  Derived classes may do the same, or take advantage of this code to do
> the loading for them via :
>     *   <pre>
> @@ -280,6 +291,11 @@
>        throws IOException, FileNotFoundException
>    {
>        String propsFile = config.getInitParameter(INIT_PROPS_KEY);
> +        if (propsFile == null || propsFile.length() == 0)
> +        {
> +            propsFile = config.getServletContext()
> +                .getInitParameter(INIT_PROPS_KEY);
> +        }
>        
>        /*
>         * This will attempt to find the location of the properties
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 

-- 
Geir Magnusson Jr.                                     [EMAIL PROTECTED]
System and Software Consulting
Java : the speed of Smalltalk with the simple elegance of C++... 


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

Reply via email to