Websocket 接受:应用程序/json使用Jersey with Dropwizard在大气中失败

Websocket 接受:应用程序/json使用Jersey with Dropwizard在大气中失败,websocket,jersey,dropwizard,atmosphere,Websocket,Jersey,Dropwizard,Atmosphere,我正在尝试使用Dropwizard和Atmosphere设置一些支持websocket的资源。我的设置基于以下代码: 我使用以下代码在Dropwizard中设置大气: AtmosphereServlet atmosphere = new AtmosphereServlet(); atmosphere.framework().addInitParameter(ApplicationConfig.ANNOTATION_PACKAGE, "my.classes"); atmosphere.framew

我正在尝试使用Dropwizard和Atmosphere设置一些支持websocket的资源。我的设置基于以下代码:

我使用以下代码在Dropwizard中设置大气:

AtmosphereServlet atmosphere = new AtmosphereServlet();
atmosphere.framework().addInitParameter(ApplicationConfig.ANNOTATION_PACKAGE, "my.classes");
atmosphere.framework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
atmosphere.framework().addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true");
atmosphere.framework().addInitParameter(ApplicationConfig.PROPERTY_COMET_SUPPORT, "org.atmosphere.container.Jetty9AsyncSupportWithWebSocket");
ServletRegistration.Dynamic servlet = environment.servlets().addServlet("atmosphere", atmosphere);
servlet.addMapping("/APIWS/*");
我用来测试它的资源如下所示:

@GET
@Produces({"application/xml", "application/json"})
public SuspendResponse<JAXBElement<CustomerListType>> getUpdates(@Context BroadcasterFactory bf) {
    Broadcaster bc = getBroadcaster(bf, hash);
    registerBroadcaster(hash, query, apiContext.getUser());
    return new SuspendResponse.SuspendResponseBuilder<JAXBElement<CustomerListType>>()
            .broadcaster(bc)
            .build();
}
一旦服务器推送某些数据,就会出现以下消息:

* STATE: PERFORM => DONE handle 0x80048248; line 1617 (connection #0)
* Curl_done
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

本条可能有助于:


谢谢你的回答,Jeanfrancois!您的意思是将
org.atmosphere.websocket.messageContentType
init参数设置为
application/json
?我尝试了设置,但不幸的是没有什么不同。将日志转到TRACE查看泽西岛内部发生了什么。我怀疑泽西队的头球有些问题,因为大气队没有使用它。谢谢!我将日志记录设置为跟踪所有相关模块,结果发现我们的一个提供程序中实际上存在错误。不确定为什么异常只出现在跟踪日志中,但我很高兴它现在可以工作了!:)谢谢你的帮助!
* STATE: PERFORM => DONE handle 0x80048248; line 1617 (connection #0)
* Curl_done
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server