氛围 - 如何从struts 2动作推送数据

时间:2013-05-23 10:58:57

标签: java push atmosphere

我的问题是如何在不使用javaScript的情况下从大气中的服务器推送数据

我按照聊天教程这是可以理解的,现在我想从struts 2中的一个动作推送数据(而不是来自javascript)我知道我必须调用.onMessage()方法但是我被阻止了构建我试过的AtmosphereResponse参数

AtmosphereResponse response = new AtmosphereResponse.Builder().build();

但是当我使用NullPointerExeption methode

时它会返回response.write()

非常感谢您的合作

1 个答案:

答案 0 :(得分:1)

解决方案:BroadcasterFactory.getDefault().lookup("/atmosphere").broadcast(message);

"/atmosphere"是您的AtmosphereServlet模式