Description
miceuz opened SPR-5505 and commented
I have two interceptors in my HandlerMapping:
OpenSessionInViewInterceptor and
legacy xt ajax interceptor that utilizes postHandle method and uses ModelAndView returned from controller to get command object - i.e. i can't return null from controller, i need modelAndView in interceptor.
the problem is that i get "javax.servlet.ServletException: ModelAndView [ModelAndView: materialized View is [null]; model is {}] neither contains a view name nor a View object" exceotion in DispatcherServlet after ajax submit event.
My ajax interceptor prepares the response and clears ModelAndView, but WebRequestHandlerInterceptorAdapter, which wraps OpenSessionInViewInterceptor calls getModel() on my modelAndView object. This creates an empty model map in modelNadView:
public ModelMap getModelMap() {
if (this.model == null) {
this.model = new ModelMap();
}
return this.model;
}
and modelAndView.wasCleared() is no longer true.
Affects: 2.5.6