lukaszlenart commented on code in PR #789:
URL: https://github.com/apache/struts/pull/789#discussion_r1392322475
##########
plugins/velocity/src/main/java/org/apache/struts2/views/velocity/StrutsVelocityContext.java:
##########
@@ -54,38 +55,55 @@ public StrutsVelocityContext(ValueStack stack) {
/**
* @deprecated please use {@link #StrutsVelocityContext(List, ValueStack)}
*/
- @Deprecated()
+ @Deprecated
public StrutsVelocityContext(VelocityContext[] chainedContexts, ValueStack
stack) {
this(new ArrayList<>(Arrays.asList(chainedContexts)), stack);
}
+ @Override
public boolean internalContainsKey(String key) {
return internalGet(key) != null;
}
+ @Override
public Object internalGet(String key) {
- Object val = super.internalGet(key);
- if (val != null) {
- return val;
- }
- if (stack != null) {
- val = stack.findValue(key);
+ for (Function<String, Object> contextGet : contextGetterList()) {
+ Object val = contextGet.apply(key);
if (val != null) {
return val;
}
- val = stack.getContext().get(key);
+ }
+ return null;
+ }
+
+ protected List<Function<String, Object>> contextGetterList() {
+ return Arrays.asList(super::internalGet, this::chainedContextGet,
this::stackGet, this::stackContextGet);
Review Comment:
I think this is fine, we will see if this will produce some backward
incompatibility
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]