Skip to content

Instantly share code, notes, and snippets.

@eldermoraes
Created September 21, 2018 15:31
Show Gist options
  • Save eldermoraes/e4b52c208a8f8a26b9fcb0350920813d to your computer and use it in GitHub Desktop.
Save eldermoraes/e4b52c208a8f8a26b9fcb0350920813d to your computer and use it in GitHub Desktop.
@Stateless
@Path("playerService")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class PlayerService {
@EJB
private PlayerBean playerBean;
@GET
@Path("findById/{id}")
public Response findById(@PathParam("id") Long id){
return Response.ok(playerBean.findById(id)).build();
}
@GET
@Path("findAll")
public Response findAll(){
return Response.ok(playerBean.findAll()).build();
}
@POST
public Response save(Player player){
playerBean.save(player);
return Response.accepted().build();
}
@DELETE
public Response remove(Player player){
playerBean.remove(player);
return Response.accepted().build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment