moved server configuration injection to pre-request

pull/834/head
Justin Richer 2015-06-01 19:09:42 -04:00
parent 54e3b7e8d3
commit dfc8df42f5
1 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,8 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/** /**
* *
* Injects the server configuration bean into the Model context, if it exists. Allows JSPs and the like to call "config.logoUrl" among others. * Injects the server configuration bean into the request context.
* This allows JSPs and the like to call "config.logoUrl" among others.
* *
* @author jricher * @author jricher
* *
@ -40,10 +41,9 @@ public class ServerConfigInterceptor extends HandlerInterceptorAdapter {
private ConfigurationPropertiesBean config; private ConfigurationPropertiesBean config;
@Override @Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (modelAndView != null) { // skip checking at all if we have no model and view to hand the config to request.setAttribute("config", config);
modelAndView.addObject("config", config); return true;
}
} }
} }