Spring 客户端仅在asnycontext.complete之后接收数据

Spring 客户端仅在asnycontext.complete之后接收数据,spring,tomcat7,asyncsocket,asynchronous,Spring,Tomcat7,Asyncsocket,Asynchronous,我使用AsyncContext异步处理客户机请求。在我的服务器端代码中,我是这样做的 ->在控制器类中,我检索并存储异步上下文 @RequestMapping(method = RequestMethod.GET, value = "/xyz/") public void getXyz(HttpServletRequest request, HttpServletResponse response) { final AsyncContext asyncContext = request.star

我使用AsyncContext异步处理客户机请求。在我的服务器端代码中,我是这样做的

->在控制器类中,我检索并存储异步上下文

@RequestMapping(method = RequestMethod.GET, value = "/xyz/")
public void getXyz(HttpServletRequest request, HttpServletResponse response) {
final AsyncContext asyncContext = request.startAsync(request, response);
map.put("xyz", asyncContext);
->我的应用程序中的线程池从MQ接收消息并在asyncContext上写入数据 //将消息转换为JSON字符串,然后 //从地图检索上下文

asyncContext.getResponse().getOutputStream().print(strMessage);
asyncContext.getResponse().getOutputStream().flush();
如果这是最后一个块,或者在异常情况下

asyncContext.complete();
现在,问题或行为是我的浏览器正在进行GET调用,当服务器在outputstream上写入数据时不接收数据,而只是在服务器执行时获取数据

asyncContext.complete();
我希望我的浏览器在数据写入outputstream(并刷新)后立即接收数据,而不是等到asyncContext完成,因为它可能永远不会被调用

正在寻找类似atmosphere broadcaster或HTML5 SSE的解决方案,但仅使用AyncContext