1

我将 Primefaces Push(3.4 中的新事物)与 jsf2 和 ejb3 一起使用。分离 .war 和 ejb.jar

现在我需要从 ejb 层触发一个 prime-push 事件。什么是干净的方法来做到这一点?我能想到的一些选择:

  1. ManagedBean 在调用 ejb 方法时向下传递一个回调接口
  2. Web 层中的 JMS 消息侦听器和用于发送消息的 ejb。
  3. 托管 bean 用于分析从 ejb 方法调用返回的数据,并在满足条件时进行推送。

基本上问题是在哪里放置下面的代码?

PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications", new FacesMessage(summary, detail));  
4

1 回答 1

0

我的工作是什么,我没有采用上面的任何想法,只是添加了从 EJB 层访问大气 API 所需的依赖项。

ejb.jar 的 MANIFEST.MF:

Manifest-Version: 1.0
Class-Path: 
atmosphere-runtime-1.0.1.jar 
atmosphere-compat-jbossweb-1.0.1.jar
atmosphere-compat-tomcat7-1.0.1.jar 
atmosphere-compat-tomcat-1.0.1.jar 

在 ejb.jar 和 application.ear 的 pom.xml 中

    <dependency>
        <groupId>org.atmosphere</groupId>
        <artifactId>atmosphere-runtime</artifactId>
        <version>1.0.1</version>
        <scope>provided</scope>
    </dependency>

然后简单地将两个包从 primefaces 源复制到 ejb.jar

org.primefaces.push
org.primefaces.json

因为在 pom.xml 中为 ejb.jar 添加 primefaces 导致

Missing artifact org.primefaces:primefaces
于 2012-10-21T14:59:14.793 回答