【问题标题】:How to configure custom AtmosphereResource in Atmosphere framework如何在 Atmosphere 框架中配置自定义 AtmosphereResource
【发布时间】:2018-02-16 07:17:38
【问题描述】:

无法将 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>

【问题讨论】:

    标签: java websocket configuration comet atmosphere


    【解决方案1】:

    这个问题的解决方案已经在大气中可用。由于 API 文档主要集中在示例应用程序如何实现这些功能,因此在其文档中没有正确讨论这些功能。

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

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

    【讨论】:

      猜你喜欢
      • 2014-01-15
      • 2015-10-29
      • 1970-01-01
      • 2012-05-10
      • 2015-01-25
      • 1970-01-01
      • 2013-01-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多