protected Map<String, Object> buildScope(Request request) { Map<String, Object> scope = new HashMap<String, Object>(); List<String> availableScopes = request.getAvailableScopes(); for (int i = availableScopes.size() - 1; i >= 0; --i) { scope.putAll(request.getContext(availableScopes.get(i))); } return scope; }
@Override public ViewPreparer getPreparer(String name, Request context) { WebApplicationContext webApplicationContext = (WebApplicationContext) context.getContext("request").get(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (webApplicationContext == null) { webApplicationContext = (WebApplicationContext) context .getContext("application") .get(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (webApplicationContext == null) { throw new IllegalStateException( "No WebApplicationContext found: no ContextLoaderListener registered?"); } } return getPreparer(name, webApplicationContext); }