@ManagedService 路径中的参数为空

Params from @ManagedService path are null

实际上我想从@ManagedService 路径中检索两个参数,但我只得到空值。 代码类似于:

...
import org.atmosphere.config.service.PathParam;
import org.atmosphere.config.service.ManagedService;
import org.atmosphere.config.service.Singleton;

@Singleton
@ManagedService(path = "/chat/{myId}/{destId}")
public class Chat {

  @PathParam("myId")
  private String mittId;

  @PathParam("destId")
  private String destId;

  @Ready
  public void onReady(AtmosphereResource r) {
    logger.info("User {} want to chat with {}", mittId,destId);
  }

调试 "mittId" 和 "destId" 为空。 代码有什么错误还是我忘记了什么? 其实我用的是Atmosphere-runtime 2.3.0.

感谢任何愿意提供帮助的人!

您没有共享足够的 或原始 back-end 代码,或者您的客户端应用程序调用聊天资源不正确。

我测试了您的示例,两个路径参数 都被 填充了。 请查看 Atmosphere Github 页面中有关 multichatroom 的示例,尤其是客户端实现。

客户端正确。我决定删除 @Singleton 注释。现在,当我调试时,我可以看到这两个参数的值。