use of com.xpn.xwiki.api.DeprecatedContext in project xwiki-platform by xwiki.
the class DefaultVelocityManager method getVelocityContext.
@Override
public VelocityContext getVelocityContext() {
ScriptVelocityContext velocityContext;
// Make sure the velocity context support ScriptContext synchronization
VelocityContext currentVelocityContext = getCurrentVelocityContext();
if (currentVelocityContext instanceof ScriptVelocityContext) {
velocityContext = (ScriptVelocityContext) currentVelocityContext;
} else {
velocityContext = new ScriptVelocityContext(currentVelocityContext, this.reservedBindings);
this.execution.getContext().setProperty(VelocityExecutionContextInitializer.VELOCITY_CONTEXT_ID, velocityContext);
}
// Synchronize with ScriptContext
ScriptContext scriptContext = this.scriptContextManager.getScriptContext();
velocityContext.setScriptContext(scriptContext);
// Velocity specific bindings
XWikiContext xcontext = this.xcontextProvider.get();
// Add the "context" binding which is deprecated since 1.9.1.
velocityContext.put("context", new DeprecatedContext(xcontext));
return velocityContext;
}
Aggregations