package com.covas; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/json") public class HelloRessource { Set hello = Collections.synchronizedSet(new LinkedHashSet<>()); public HelloRessource(){ hello.add(new Hello("toto")); } @GET public Response hello_json(){ return Response.ok(this.hello).build(); } }