Closed
Description
Dave Syer opened SPR-5686 and commented
Expose model object in RequestContext. Background:
Trying to use Freemarker with Tiles, and I want to manipulate the model from an "enclosing" request and, while I can get hold of the RequestContext via the AbstractTemplateView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE, but then I can only get the model by using Field.setAccessible(true), e.g.
String contextAttribute = AbstractTemplateView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE;
RequestContext context = (RequestContext) request
.getAttribute(contextAttribute);
if (context != null) {
@SuppressWarnings("unchecked")
Map<String, Object> model = (Map<String, Object>) MacroModelInterceptor
.getField(context, "model");
model.remove(contextAttribute);
modelAndView.addAllObjects(model);
request.removeAttribute(contextAttribute);
}
Affects: 2.5.6
Referenced from: commits c230c18