无法将Atmosphere配置为使用自定义AtmosphereResource而不是AtmosphereResourceImpl。我试图在Servlet配置中使用init-param,如下所示,但它不起作用。

<init-param>
    <param-name>org.atmosphere.cpr.AtmosphereResource</param-name>
    <param-value>com.sample.MyAtmosphereResource</param-value>
</init-param>

最佳答案

该问题的解决方案已经在大气中可用。由于API文档主要集中在示例应用程序的工作方式上,因此在其文档中未正确讨论这些功能。

以下链接具有一些可以做一些很棒的事情的Atmosphere注释。
http://async-io.org/apidocs/index.html?org/atmosphere/config/service/package-summary.html

这个问题的答案是,
通过实现AtmosphereResourceFactory创建工厂,该工厂创建Custom AtmosphereResource对象,并将工厂注释为@AtmosphereResourceFactoryService。就这样。现在您可以看到自定义的AtmosphereResource资源已传递到AtmosphereHandler

09-10 03:22
查看更多