package managed;

import ejb.BigBangFacadeLocal;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.transaction.UserTransaction;
import javax.ws.rs.GET;

import javax.ws.rs.Path;

/**
 *
 * @author Clayton K. N. Passos
 */
@Named
@RequestScoped
@Path("popular")
public class PopularCDINOK {

//    This is not work
    @EJB(beanName = "BigBangFacade")
    private BigBangFacadeLocal bang;

    @Resource
    private UserTransaction tx;

//  This is not work too
//    @EJB
//    private BigBangFacade bang;
    /** Creates a new instance of PopularCDINOK */
    public PopularCDINOK() {
    }

    /*
     * Open: http://localhost:8080/GuaxiniBigFat/rest/popular/popular
     */
    @GET
    @Path("popular")
    public String popular() {

        if (bang == null) {
            System.out.println("PopularCDINOK fail... is null");
        }

        bang.print();


        return "index";
    }

    public String index() {
        System.out.println("vai.xhtml");
        return "vai";
    }
}
