[ 
https://issues.apache.org/jira/browse/WW-5334?focusedWorklogId=876751&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-876751
 ]

ASF GitHub Bot logged work on WW-5334:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Aug/23 09:01
            Start Date: 17/Aug/23 09:01
    Worklog Time Spent: 10m 
      Work Description: kusalk commented on code in PR #731:
URL: https://github.com/apache/struts/pull/731#discussion_r1296902056


##########
plugins/velocity/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java:
##########
@@ -130,33 +129,38 @@ public VelocityEngine getVelocityEngine() {
      * @return a new StrutsVelocityContext
      */
     public Context createContext(ValueStack stack, HttpServletRequest req, 
HttpServletResponse res) {
-        List<VelocityContext> chainedContexts = prepareChainedContexts(req, 
res, stack.getContext());
-        StrutsVelocityContext context = new 
StrutsVelocityContext(chainedContexts, stack);
-        Map<String, Object> standardMap = 
ContextUtil.getStandardContext(stack, req, res);
-        for (Map.Entry<String, Object> entry : standardMap.entrySet()) {
-            context.put(entry.getKey(), entry.getValue());
+        Context context = buildToolContext();
+        if (context == null) {
+            context = buildContext(stack, req, res);
         }
+        req.setAttribute(KEY_VELOCITY_STRUTS_CONTEXT, context);
+        return context;
+    }
+
+    protected Context buildContext(ValueStack stack, HttpServletRequest req, 
HttpServletResponse res) {

Review Comment:
   Factored this out so the default Velocity context can be easily overridden





Issue Time Tracking
-------------------

    Worklog Id:     (was: 876751)
    Time Spent: 20m  (was: 10m)

> Misc VelocityManager code cleanup
> ---------------------------------
>
>                 Key: WW-5334
>                 URL: https://issues.apache.org/jira/browse/WW-5334
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Velocity
>            Reporter: Kusal Kithul-Godage
>            Priority: Minor
>             Fix For: 6.4.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to