gpt4 book ai didi

java - 带有 Jersey 2 的 Atmosphere PubSub

转载 作者:搜寻专家 更新时间:2023-11-01 03:52:03 25 4
gpt4 key购买 nike

我正在尝试使用带有 Jersey 2.8 的 Atmosphere 来实现发布-订阅逻辑。我的理解是 atmosphere-jersey 只支持 Jersey 1.x。在 Jersey 2 中实现 pub-sub 需要什么?我需要使用哪些方法以及@AtmosphereService 之外的哪些注释:

@Path("/chat/{topic}")
@AtmosphereService(
dispatch = false,
interceptors = {AtmosphereResourceLifecycleInterceptor.class, TrackMessageSizeInterceptor.class},
path = "/chat/{topic}",
servlet = "org.glassfish.jersey.servlet.ServletContainer")
public class Jersey2Resource {
private
@PathParam("topic")
Broadcaster topic;

我知道这个问题很宽泛,但大多数 Atmosphere 样本似乎都依赖于 Jersey 1.x。

谢谢!

最佳答案

移除这个拦截器 AtmosphereResourceLifecycleInterceptor 并改为编写 Get 方法。您可以通过扩展该拦截器或遵循其结构来编写新的拦截器

关于java - 带有 Jersey 2 的 Atmosphere PubSub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23636621/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com