use of com.runwaysdk.mvc.InputStreamResponse in project geoprism-registry by terraframe.
the class TransitionEventController method exportExcel.
@Endpoint(method = ServletMethod.GET, error = ErrorSerialization.JSON, url = "export-excel")
public ResponseIF exportExcel(ClientRequestIF request, @RequestParamter(name = "typeCode", required = true) String typeCode, @RequestParamter(name = "startDate") String startDate, @RequestParamter(name = "endDate") String endDate) throws ParseException, IOException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
Date sDate = startDate != null ? format.parse(startDate) : new Date();
Date eDate = endDate != null ? format.parse(endDate) : new Date();
return new InputStreamResponse(service.exportExcel(request.getSessionId(), typeCode, sDate, eDate), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "historical-report.xlsx");
}
Aggregations