I have an interceptor that extends HandlerInterceptorAdapter
.
When I add an object to my ModelAndView
, it is also added to my URL as a path variable, but I do not want this.
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) { if (null == modelAndView) { return; } log.info("Language in postHandle: {}", LocaleContextHolder.getLocale()); modelAndView.addObject("selectedLocale", LocaleContextHolder.getLocale()); }
When I add something to my ModelAndView
in the controller itself, it does not appear in the url.
source share