Permalink
Browse files

Process templates twice. The second time, use the output from the first

parsing to build the template text.

This means one can now nest template variables.
eg,
<param name="body" value="${body.passed}" />

The first time, ${body.passed} will be populated and on the second
parsing, body will contain the text resolved in the first parsing.

The downside is that lots of warnings like the following:
java.lang.NoSuchMethodException thrown when trying to resolve value for
body.passed 
For that reason, these warnings have been downgraded to debug level in
log4j.
  • Loading branch information...
1 parent 2b21c8a commit 46dd8e20a61fae995e68e59f31c34b9fa146c3da @netwolfuk netwolfuk committed Jul 20, 2015
@@ -511,6 +511,11 @@ public ExtraParametersMap getExtraParameters() {
builder = VariableMessageBuilder.create(entry.getValue(), resolver);
resolvedParametersMap.put(entry.getKey(), builder.build());
}
+ resolver = new WebHooksBeanUtilsVariableResolver(this, resolvedParametersMap);
+ for (Entry<String,String> entry : extraParameters.getEntriesAsSet()){
+ builder = VariableMessageBuilder.create(entry.getValue(), resolver);
+ resolvedParametersMap.put(entry.getKey(), builder.build());
+ }
return resolvedParametersMap;
} else {
return null;
@@ -43,13 +43,13 @@ public String resolve(String variableName) {
value = (String) PropertyUtils.getProperty(bean, variableName);
} catch (IllegalAccessException e) {
- Loggers.SERVER.warn(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
+ Loggers.SERVER.debug(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
Loggers.SERVER.debug(e);
} catch (InvocationTargetException e) {
- Loggers.SERVER.warn(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
+ Loggers.SERVER.debug(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
Loggers.SERVER.debug(e);
} catch (NoSuchMethodException e) {
- Loggers.SERVER.warn(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
+ Loggers.SERVER.debug(this.getClass().getSimpleName() + " :: " + e.getClass() + " thrown when trying to resolve value for " + variableName);
Loggers.SERVER.debug(e);
}
return value;

0 comments on commit 46dd8e2

Please sign in to comment.