velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r524328 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Date Fri, 30 Mar 2007 23:39:27 GMT
Author: nbubna
Date: Fri Mar 30 16:39:26 2007
New Revision: 524328

URL: http://svn.apache.org/viewvc?view=rev&rev=524328
Log:
distinguish between context creation and context preparation

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java?view=diff&rev=524328&r1=524327&r2=524328
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
(original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
Fri Mar 30 16:39:26 2007
@@ -754,19 +754,24 @@
      * @param request servlet request from client
      * @param response servlet reponse to client
      */
-    protected Context createContext(HttpServletRequest request,
-                                    HttpServletResponse response)
+    protected ViewToolContext createContext(HttpServletRequest request,
+                                            HttpServletResponse response)
     {
         ViewToolContext ctx =
             new ViewToolContext(velocity, request, response, servletContext);
+        prepareContext(ctx);
+        return ctx;
+    }
+
+    protected void prepareContext(ViewToolContext context)
+    {
         // if this view is storing toolboxes under a non-standard key,
         // then retrieve it's toolboxes here, since ViewToolContext won't
         // know where to find them
         if (!this.toolboxKey.equals(DEFAULT_TOOLBOX_KEY))
         {
-            ctx.addToolboxesUnderKey(this.toolboxKey);
+            context.addToolboxesUnderKey(this.toolboxKey);
         }
-        return ctx;
     }
 
 
@@ -795,7 +800,7 @@
      */
     protected Template getTemplate(HttpServletRequest request)
     {
-        return getTemplate(ServletUtils.getPath(request));
+        return getTemplate(request, null);
     }
 
     protected Template getTemplate(HttpServletRequest request,



Mime
View raw message