use of com.thoughtworks.go.util.json.JsonAware in project gocd by gocd.
the class SimpleJsonView method render.
@Override
public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
// In IE, there's a problem with caching. We want to cache if we can.
// This will force the browser to clear the cache only for this page.
// If any other pages need to clear the cache, we might want to move this
// logic to an intercepter.
GoRequestContext goRequestContext = new GoRequestContext(request);
response.addHeader("Cache-Control", GoConstants.CACHE_CONTROL);
response.setStatus(status);
response.setContentType(getContentType());
Object json = jsonAware;
if (jsonAware instanceof JsonAware) {
json = ((JsonAware) jsonAware).toJson();
}
PrintWriter writer = response.getWriter();
JsonRenderer.render(json, goRequestContext, writer);
writer.close();
}
Aggregations