@POST @Produces(MediaType.APPLICATION_JSON) public void addEmploye() { Employe employe = new Employe(); employeEjb.addEmploye(employe); Reponse("200"); }
@GET @Path("/list") @Produces(MediaType.APPLICATION_JSON) public List<Employe> list() { List<Employe> employes = new ArrayList<Employe>(); // employes.add(new Employe()); employes = employeEjb.findAll(); Reponse("200"); return employes; }
@GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Employe findById(@PathParam("id") Integer id) { Employe employe = employeEjb.findById(id); if (employe != null) { Reponse("200"); } else { Reponse("404 Not Found"); } return employe; }