java.lang.IllegalStateException:UT010026:此请求不支持异步,因为并非所有过滤器或Servlet都标记为支持异步

时间:2015-10-31 15:22:55

标签: jsf primefaces push atmosphere

在PrimeFaces 5.3中推送对我不起作用:

的web.xml。

<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>

<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
<dependency>
    <groupId>org.atmosphere</groupId>
    <artifactId>atmosphere-runtime</artifactId>
    <version>2.4.0-RC5</version>
</dependency>

我正在使用WildFly 8.2

我明白了:

ERROR [org.atmosphere.cpr.AtmosphereFramework] (default task-61) AtmosphereFramework exception: java.lang.IllegalStateException: UT010026: Async is not supported for this request, as not all filters or Servlets were marked as supporting async

有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

// servlet.setAsyncSupported(true);

//For Example

public class WebAppInitializer implements WebApplicationInitializer {
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
        ctx.register(WebMvcConfig.class);
        ctx.register(WebHibernateConfiguration.class);
        ctx.register(SwaggerConfig.class);
        ctx.setServletContext(servletContext);
        ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher",
            new DispatcherServlet(ctx));
        servlet.setLoadOnStartup(1);
        servlet.addMapping("/");
        servlet.setAsyncSupported(true); //Servlets were marked as supporting async
        // For CORS Pre Filght Request
        servlet.setInitParameter("dispatchOptionsRequest", "true");
    }
}