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>
- * <servlet >
+ * <servlet>
* <servlet-name> YourServlet </servlet-name>
* <servlet-class> your.package.YourServlet </servlet-class>
* <init-param>
@@ -261,6 +261,17 @@
* </init-param>
* </servlet>
* </pre>
+ *
+ * Alternately, if you wish to configure an entire context in this
+ * fashion, you may use the following:
+ * <br>
+ * <pre>
+ * <context-param>
+ * <param-name> properties </param-name>
+ * <param-value> velocity.properties </param-value>
+ * <description> Path to Velocity configuration </description>
+ * </context-param>
+ * </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>