Код: Выделить всё
@GET
@Path("/paises/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Response findCountryList(@PathParam("id")int id){
try{
ArrayList lista = new ArrayList();
for(int i=0; i x.getId()==id).findAny().get();
if(id > lista.size()-1) throw new Exception("That id is not correct");
return Response.ok(co).build();
}catch(Exception e){
return Response.status(404).entity(e.getMessage()).build();
}
}
п>
Подробнее здесь: https://stackoverflow.com/questions/502 ... cation-jso