{
Object bean = SpringUtils.getSpringBean(actionContext.getContext(), name);
if (!(bean instanceof ViewResolver))
{
throw new ApplicationConfigurationException("Bean referenced using the 'resolver' attribute of @"
+ SpringView.class.getSimpleName() + " annotation is not instance of "
+ ViewResolver.class.getName());
}
ViewResolver viewResolver = (ViewResolver) bean;
String viewName = modelAndView.getViewName();
try
{
Locale locale = (Locale) request.getAttribute(Globals.LOCALE_KEY);
view = viewResolver.resolveViewName(viewName, locale);
}
catch (Exception e)
{
throw new ApplicationRuntimeException("Exception thrown during resolution of view name " + viewName
+ " using ViewResolver " + viewResolver.getClass(), e);
}
}
// no resolver supplied: use name to look up View
else
{
String viewName = modelAndView.getViewName();
Object bean = SpringUtils.getSpringBean(actionContext.getContext(), viewName);
if (!(bean instanceof View))
{
throw new ApplicationConfigurationException(
"Bean referenced using the 'viewName' property of the returned ModelAndView of the method containing @"
+ SpringView.class.getSimpleName() + " is not an instance of " + View.class.getName());
}
view = (View) bean;