@SuppressWarnings("unchecked")
public void renderMergedOutputModel(Map model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
response.setContentType(getContentType());
response.setCharacterEncoding(encoding);
RequestContext rc = getRequestContext(model);
BindingResult br = getBindingResult(model);
String commandName = getCommandName(br);
JsonWriterConfiguratorTemplateRegistry configuratorTemplateRegistry = getConfiguratorTemplateRegistry(request);
jsonViewFilter.filterBeforePopulate(model, commandName);
if(hasErrors(rc, br)){
jsonViewFilter.filterBeforePopulateErrors(model, commandName);
jsonViewCallback.onPopulateErrors(model, rc, br);
triggerJsonErrors(model, rc, br, request, response);
}else{
jsonViewFilter.filterBeforePopulateSuccess(model, commandName);
jsonViewCallback.onPopulateSuccess(model, rc, br);
}
if (hijackSafe){
response.getWriter().print("/*" + hijackSafePrefixPostFix);
}
jsonWriter.convertAndWrite(model, configuratorTemplateRegistry, response.getWriter(), br);
if (hijackSafe){
response.getWriter().print(hijackSafePrefixPostFix + "*/");
}
}