@Path("/count/course/signups/{id}") @GET @Produces(MediaType.APPLICATION_JSON) public Response getCountCourseSignup( @PathParam("id") final String courseId, @QueryParam("status") final Status status) throws JsonGenerationException, JsonMappingException, IOException { checkAuthenticated(); // All the pending Set<Status> statuses = null; if (null != status) { statuses = Collections.singleton(status); } Integer signups = courseService.getCountCourseSignups(courseId, statuses); return Response.ok(objectMapper.writeValueAsString(signups)).build(); }