From 33d6d288d07fdd24fa8a6307d3eff8d371f5932a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 10 Dec 2016 10:57:01 +1300 Subject: Return JSON response by default --- src/org/traccar/api/resource/EventResource.java | 1 + src/org/traccar/api/resource/PositionResource.java | 3 ++- src/org/traccar/api/resource/ReportResource.java | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/api/resource/EventResource.java b/src/org/traccar/api/resource/EventResource.java index c0a8f968d..0ef5456af 100644 --- a/src/org/traccar/api/resource/EventResource.java +++ b/src/org/traccar/api/resource/EventResource.java @@ -29,4 +29,5 @@ public class EventResource extends BaseResource { } return event; } + } diff --git a/src/org/traccar/api/resource/PositionResource.java b/src/org/traccar/api/resource/PositionResource.java index 84f406bee..9d3cd9ae6 100644 --- a/src/org/traccar/api/resource/PositionResource.java +++ b/src/org/traccar/api/resource/PositionResource.java @@ -37,6 +37,7 @@ import java.util.Collection; import java.util.List; @Path("positions") +@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class PositionResource extends BaseResource { @@ -46,7 +47,6 @@ public class PositionResource extends BaseResource { public static final String CONTENT_DISPOSITION_VALUE_GPX = "attachment; filename=positions.gpx"; @GET - @Produces(MediaType.APPLICATION_JSON) public Collection getJson( @QueryParam("deviceId") long deviceId, @QueryParam("id") List positionIds, @QueryParam("from") String from, @QueryParam("to") String to) @@ -92,4 +92,5 @@ public class PositionResource extends BaseResource { deviceId, DateUtil.parseDate(from), DateUtil.parseDate(to))); return Response.ok(gpx.build()).header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_GPX).build(); } + } diff --git a/src/org/traccar/api/resource/ReportResource.java b/src/org/traccar/api/resource/ReportResource.java index e37d6f01d..a1b35d64e 100644 --- a/src/org/traccar/api/resource/ReportResource.java +++ b/src/org/traccar/api/resource/ReportResource.java @@ -27,6 +27,7 @@ import org.traccar.reports.model.TripReport; import org.traccar.reports.Route; @Path("reports") +@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class ReportResource extends BaseResource { @@ -35,7 +36,6 @@ public class ReportResource extends BaseResource { @Path("route") @GET - @Produces(MediaType.APPLICATION_JSON) public Collection getRoute( @QueryParam("deviceId") final List deviceIds, @QueryParam("groupId") final List groupIds, @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException { @@ -59,7 +59,6 @@ public class ReportResource extends BaseResource { @Path("events") @GET - @Produces(MediaType.APPLICATION_JSON) public Collection getEvents( @QueryParam("deviceId") final List deviceIds, @QueryParam("groupId") final List groupIds, @QueryParam("type") final List types, @@ -85,7 +84,6 @@ public class ReportResource extends BaseResource { @Path("summary") @GET - @Produces(MediaType.APPLICATION_JSON) public Collection getSummary( @QueryParam("deviceId") final List deviceIds, @QueryParam("groupId") final List groupIds, @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException { -- cgit v1.2.3