0

在我的 spring 3 控制器中执行以下方法期间,我收到错误(AtmosphereResource 类型不是通用的;它不能用参数参数化)。

 @RequestMapping(value="/websockets", method=RequestMethod.GET)
     @ResponseBody
     public void websockets(final AtmosphereResource<HttpServletRequest,HttpServletResponse> event) {

          final HttpServletRequest  req = event.getRequest();
            final HttpServletResponse res = event.getResponse();
            event.suspend();

            final Broadcaster bc = event.getBroadcaster();
            bc.scheduleFixedBroadcast(new Callable<String>() {

                public String call() throws Exception {

                    return (new Date()).toString();
                }
            }, 11, TimeUnit.SECONDS);
     }
4

1 回答 1

3

您可能想出了答案,但从AtmosphereResource<?,?>0.9 及更高版本开始不再存在。只需删除它,它就会起作用。

于 2013-03-06T18:52:57.227 回答