@POST @Path("update") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public void updateLocation(com.clueride.rest.dto.Location location) { locationService.updateLocation(location); }
/** * Handles upload request for a new image at the given location. * * @param lat - Double latitude of device location. * @param lon - Double longitude of device location. * @param locationId - Optional Integer representing an existing location (which may not have been * created yet). * @param fileData - InputStream from which we read the image data to put into a file. * @return "OK" confirming success. */ @POST @Path("uploadImage") @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.MULTIPART_FORM_DATA) public String uploadImage( @QueryParam("lat") Double lat, @QueryParam("lon") Double lon, @QueryParam("locId") Integer locationId, @FormDataParam("file") InputStream fileData) { locationService.saveLocationImage(lat, lon, locationId, fileData); return "OK"; }
/** Handles GET requests for a location's Map. */ @GET @Path("map") @Produces(MediaType.APPLICATION_JSON) public String getLocationGeometry(@QueryParam("locationId") Integer locationId) { return locationService.getLocationGeometry(locationId); }
@GET @Path("types") @Produces(MediaType.APPLICATION_JSON) public String getTypes() { return locationService.getLocationTypes(); }
/** Handles GET requests for the data supporting specific Locations. */ @GET @Produces(MediaType.APPLICATION_JSON) public String getLocation(@QueryParam("id") Integer locationId) { return locationService.getLocation(locationId); }
@GET @Path("course") @Produces(MediaType.TEXT_PLAIN) public String getCourseLocations(@QueryParam("courseId") Integer courseId) { return locationService.getCourseLocations(courseId); }
/** * Endpoint for requesting the nearest 5 locations to offer the user for selection. * * @param lat - Latitude for current location. * @param lon - Longitude for current location. * @return JSON array containing Location objects for the five nearest locations. */ @GET @Path("nearest") @Produces(MediaType.TEXT_PLAIN) public String getNearestLocations(@QueryParam("lat") Double lat, @QueryParam("lon") Double lon) { return locationService.getNearestLocations(lat, lon); }