@GET @Path("exists") @Produces(value = MediaType.APPLICATION_JSON) public Response get(@QueryParam("username") String username) { boolean exists = service.usernameExists(username); Map<String, Boolean> result = new HashMap<>(); result.put("result", exists); return Response.ok(result).build(); }