aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/api/resource/ReportResource.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/org/traccar/api/resource/ReportResource.java b/src/org/traccar/api/resource/ReportResource.java
index 8682070b1..0dc9ab6a4 100644
--- a/src/org/traccar/api/resource/ReportResource.java
+++ b/src/org/traccar/api/resource/ReportResource.java
@@ -32,12 +32,14 @@ public class ReportResource extends BaseResource {
@Path("route")
@GET
- @Produces("application/ms-excel")
+ @Produces("text/csv")
public Response getRouteCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Route.getCsv(getUserId(), deviceIds, groupIds,
- JsonConverter.parseDate(from), JsonConverter.parseDate(to))).build();
+ JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
+ .header("Content-Disposition", "attachment; filename=route.csv")
+ .build();
}
@Path("events")
@@ -53,13 +55,15 @@ public class ReportResource extends BaseResource {
@Path("events")
@GET
- @Produces("application/ms-excel")
+ @Produces("text/csv")
public Response getEventsCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("type") final List<String> types,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Events.getCsv(getUserId(), deviceIds, groupIds,
- types, JsonConverter.parseDate(from), JsonConverter.parseDate(to))).build();
+ types, JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
+ .header("Content-Disposition", "attachment; filename=events.csv")
+ .build();
}
@Path("summary")
@@ -74,12 +78,14 @@ public class ReportResource extends BaseResource {
@Path("summary")
@GET
- @Produces("application/ms-excel")
+ @Produces("text/csv")
public Response getSummaryCsv(
@QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
@QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
return Response.ok(Summary.getCsv(getUserId(), deviceIds, groupIds,
- JsonConverter.parseDate(from), JsonConverter.parseDate(to))).build();
+ JsonConverter.parseDate(from), JsonConverter.parseDate(to)))
+ .header("Content-Disposition", "attachment; filename=summary.csv")
+ .build();
}
}