new ContextSupport(baseContextSupport.getNamespaceContext(),
new SynapseXPathFunctionContext(baseContextSupport.getFunctionContext(), synCtx),
new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), synCtx),
baseContextSupport.getNavigator());
Context context = new Context(contextSupport);
context.setNodeSet(new SingletonList(synCtx.getEnvelope()));
return context;
} else if (obj instanceof SOAPEnvelope) {
SOAPEnvelope env = (SOAPEnvelope)obj;
ContextSupport baseContextSupport = getContextSupport();
ContextSupport contextSupport =
new ContextSupport(baseContextSupport.getNamespaceContext(),
baseContextSupport.getFunctionContext(),
new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), env),
baseContextSupport.getNavigator());
Context context = new Context(contextSupport);
context.setNodeSet(new SingletonList(env));
return context;
} else if (obj instanceof ContextWrapper) {
ContextWrapper wrapper = (ContextWrapper) obj;
ContextSupport baseContextSupport = getContextSupport();
ContextSupport contextSupport =
new ContextSupport(baseContextSupport.getNamespaceContext(),
baseContextSupport.getFunctionContext(),
new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), wrapper.getMessageCtxt(),
wrapper.getEnvelope()),
baseContextSupport.getNavigator());
Context context = new Context(contextSupport);
context.setNodeSet(new SingletonList(wrapper.getEnvelope()));
return context;
} else {
return super.getContext(obj);
}
}