Upvote:7

Aprove answer
@Path("name")
@Stateless
public class NameService {
    @EJB
    private NameBean nameBean;

    @GET
    @Produces("text/html")
    public String getHtml() {
        return "<h2>Hello "+nameBean.getName()+"</h2>";
    }

    @PUT
    @Consumes("text/plain")
    public void put(String content) {
        nameBean.setName(content);
    }
}

Credit Goes to: stackoverflow.com

Related question with same questions but different answers