package lab6.rest.service; import lab6.rest.pojo.CommentPOJO; import lab6.rest.pojo.EntryPOJO; import javax.inject.Singleton; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.ArrayList; import java.util.List; @Singleton @Path("/blog") public class Blog { private List entries = new ArrayList<>(); @POST @Path("/entry") @Produces(MediaType.APPLICATION_JSON) public void addEntry(EntryPOJO json) throws Exception{ entries.add(new EntryPOJO(json.getId(), json.getDate(), json.getSubject(), json.getContent())); } @GET @Path("/entry") @Produces(MediaType.APPLICATION_JSON) public List showAllEntries() throws Exception{ return entries; } @GET @Path("/entry/{id}") @Produces(MediaType.APPLICATION_JSON) public EntryPOJO searchEntryById(@PathParam("id") int id) throws Exception{ int index = -1; for(int i=0; i showComment(@PathParam("id") int id) throws Exception{ int index = -1; for(int i=0; i