You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by dl...@apache.org on 2002/02/07 00:42:01 UTC

cvs commit: jakarta-velocity/src/java/org/apache/velocity/servlet VelocityServlet.java

dlr         02/02/06 15:42:01

  Modified:    src/java/org/apache/velocity/servlet VelocityServlet.java
  Log:
  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).
  
  Revision  Changes    Path
  1.44      +20 -4     jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServlet.java
  
  Index: VelocityServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/servlet/VelocityServlet.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -u -r1.43 -r1.44
  --- VelocityServlet.java	7 Dec 2001 00:01:55 -0000	1.43
  +++ VelocityServlet.java	6 Feb 2002 23:42:01 -0000	1.44
  @@ -127,7 +127,7 @@
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="kjohnson@transparent.com">Kent Johnson</a>
  - * $Id: VelocityServlet.java,v 1.43 2001/12/07 00:01:55 geirm Exp $
  + * $Id: VelocityServlet.java,v 1.44 2002/02/06 23:42:01 dlr Exp $
    */
   public abstract class VelocityServlet extends HttpServlet
   {
  @@ -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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-velocity/src/java/org/apache/velocity/servlet VelocityServlet.java

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/6/02 6:42 PM, "dlr@apache.org" <dl...@apache.org> wrote:

> dlr         02/02/06 15:42:01
> 
> Modified:    src/java/org/apache/velocity/servlet VelocityServlet.java
> Log:
> 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).

Not often you see the word 'bevy' in a commit log.

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>