我正在尝试配置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);
这是我的atmosphere.xml:
<atmosphere-handler context-root="/session/**"
class-name="org.atmosphere.handler.ReflectorServletProcessor">
</atmosphere-handler>
我想以编程方式配置过滤器,我可以使用大气过滤器吗?如果是的话,我做错了什么?
答案 0 :(得分:0)
问题解决了。使用MeteorServlet
代替AtmosphereFilter
,则不需要atmosphere.xml
,您应该将WicketFilter
init参数传递给MeteorServlet
。