@Path("data")
@Produces(RestUtils.TEXT_CSV)
public ViewportResults getViewportResultAsCsv(@Context HttpServletResponse response) {
ArgumentChecker.notNull(response, "response");
ViewportResults result = getView().getAllGridData(getGridType(), Format.CELL);
Instant valuationTime = result.getValuationTime() == null ? OpenGammaClock.getInstance().instant() : result.getValuationTime();
LocalDateTime time = LocalDateTime.ofInstant(valuationTime, OpenGammaClock.getZone());
String filename = String.format("%s-%s-%s.csv", getView().getViewDefinitionId(), getGridType().name().toLowerCase(), time.toString(CSV_TIME_FORMAT));
response.addHeader("content-disposition", "attachment; filename=\"" + filename + "\"");
return getView().getAllGridData(getGridType(), Format.CELL);