Fixes to if-modified-since in activity provider

4.x.x
madhawap 9 years ago
parent 4609888ad1
commit f80603a365

@ -79,7 +79,6 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
@QueryParam("limit") int limit, @QueryParam("limit") int limit,
@HeaderParam("If-Modified-Since") String ifModifiedSince) { @HeaderParam("If-Modified-Since") String ifModifiedSince) {
long sinceTimestamp = 0; long sinceTimestamp = 0;
boolean isSinceModifiedIsSet = false; boolean isSinceModifiedIsSet = false;
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
@ -103,7 +102,8 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
activities = dmService.getActivitiesUpdatedAfter(timestamp); activities = dmService.getActivitiesUpdatedAfter(timestamp);
if (activities == null || activities.size() == 0) { if (activities == null || activities.size() == 0) {
if (isSinceModifiedIsSet) { if (isSinceModifiedIsSet) {
return Response.status(Response.Status.NOT_MODIFIED).entity(activities).build(); return Response.status(Response.Status.NOT_MODIFIED).entity("No activities " +
"after the timestamp provided in 'If-Modified-Since' header").build();
} }
throw new NotFoundException( throw new NotFoundException(
new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No activities " + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No activities " +

Loading…
Cancel
Save