moved server configuration injection to pre-request
parent
54e3b7e8d3
commit
dfc8df42f5
|
@ -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;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue