use of org.springframework.web.servlet.view.AbstractView in project gocd by gocd.
the class FileModelAndView method createFileView.
public static ModelAndView createFileView(File file, String sha) throws Exception {
boolean hasChanged = isFileChanged(file, sha);
if (!hasChanged) {
return new ModelAndView(new AbstractView() {
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
response.getWriter().close();
}
});
} else {
HashMap model = new HashMap();
if (file instanceof ZippedArtifact) {
model.put(FileView.NEED_TO_ZIP, true);
}
model.put("targetFile", file);
return new ModelAndView("fileView", model);
}
}
use of org.springframework.web.servlet.view.AbstractView in project engine by craftercms.
the class CrafterPageView method renderActualView.
protected void renderActualView(String pageViewName, Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
View actualView = delegatedViewResolver.resolveViewName(pageViewName, locale);
if (actualView == null) {
throw new RenderingException("No view was resolved for page view name '" + pageViewName + "'");
}
if (actualView instanceof AbstractView) {
((AbstractView) actualView).setContentType(getContentType());
}
actualView.render(model, request, response);
}
Aggregations