// special for files so we can work with them out of the box
InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, answer);
answer = new InputSource(is);
} else if (answer instanceof BeanInvocation) {
// if its a null bean invocation then handle that
BeanInvocation bi = exchange.getContext().getTypeConverter().convertTo(BeanInvocation.class, answer);
if (bi.getArgs() != null && bi.getArgs().length == 1 && bi.getArgs()[0] == null) {
// its a null argument from the bean invocation so use null as answer
answer = null;
}
} else if (answer instanceof String) {
answer = new InputSource(new StringReader(answer.toString()));