*/
public ExtDirectResponseBuilder setException(final Exception exception) {
unsuccessful();
WebApplicationContext ctx = RequestContextUtils.getWebApplicationContext(request);
Configuration configuration = null;
try {
configuration = ctx.getBean(Configuration.class);
} catch (NoSuchBeanDefinitionException e) {
configuration = new Configuration();
}
extDirectResponse.setType("exception");
extDirectResponse.setMessage(configuration.getMessage(exception));
if (configuration.isSendStacktrace()) {
extDirectResponse.setWhere(ExtDirectSpringUtil.getStackTrace(exception));
} else {
extDirectResponse.setWhere(null);
}