我正在尝试配置 Atmosphere,这就是我将事件发布到 EventBus 时得到的
java.lang.IllegalStateException: MeteorServlet not defined in web.xml
at org.atmosphere.cpr.Meteor.build(Meteor.java:170) ~[atmosphere-runtime-1.0.8.jar:1.0.8]
at org.atmosphere.cpr.Meteor.build(Meteor.java:151) ~[atmosphere-runtime-1.0.8.jar:1.0.8]
at org.atmosphere.cpr.Meteor.build(Meteor.java:137) ~[atmosphere-runtime-1.0.8.jar:1.0.8]
at org.atmosphere.cpr.Meteor.build(Meteor.java:124) ~[atmosphere-runtime-1.0.8.jar:1.0.8]
at org.apache.wicket.atmosphere.AtmosphereBehavior.onResourceRequested(AtmosphereBehavior.java:107) ~[wicket-atmosphere-0.7.jar:0.7]
... 56 common frames omitted
我使用 Wicket,这是 AjaxButton onSubmit 实现:
public void onSubmit(AjaxRequestTarget target, Form<?> form) {
EventBus.get().post(message.getModelObject());
}
我正在使用 Guice 配置 Atmosphere。在我的 ServletModule 实现中:
Map<String, String> params = new HashMap<String, String>();
params.put("applicationClassName", "org.mycompany.MyWebApplication");
params.put(ApplicationConfig.PROPERTY_SERVLET_MAPPING, "/session/**");
params.put(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true");
params.put(ApplicationConfig.WEBSOCKET_PROTOCOL, "org.atmosphere.websocket.protocol.EchoProtocol");
params.put(ApplicationConfig.BROADCAST_FILTER_CLASSES, "org.apache.wicket.atmosphere.TrackMessageSizeFilter");
filter("/session/**").through(AtmosphereFilter.class, params);
这是我的大气.xml:
<atmosphere-handler context-root="/session/**"
class-name="org.atmosphere.handler.ReflectorServletProcessor">
</atmosphere-handler>
我想以编程方式配置过滤器,我可以使用大气过滤器吗?如果是,我做错了什么?