如何避免ASYNC_SUPPORTED =请求集真在Tomcat 7中启用异步的servlet 3.0处理? [英] How to avoid request set ASYNC_SUPPORTED=true to enable async servlet 3.0 processing on Tomcat 7?

查看:2027
本文介绍了如何避免ASYNC_SUPPORTED =请求集真在Tomcat 7中启用异步的servlet 3.0处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继报道了这一问题<一href=\"http://stackoverflow.com/questions/7749350/illegalstateexception-not-supported-on-asynccontext-startasyncreq-res\">question,找到了解决办法:

Following an issue reported on this question, a solution was found:

req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);

这似乎有点奇怪,是不是真的便携code(它不会伤害,但是......)。通过的NetBeans 7.0.1在交付这似乎具体到Tomcat 7.我使用Tomcat 7.0.14。

This seems a bit strange and is not really 'portable' code (it won't hurt, but...). It seems specific to Tomcat 7. I am using Tomcat 7.0.14 as delivered by NetBeans 7.0.1.

我找不到文件说明,有必要启用的servlet 3.0异步请求处理与卡特琳娜属性。我找不到文件说明在Tomcat的配置水平太特别的东西是必要的。

I could not find documentation indicating it is necessary to enable async request processing in servlet 3.0 with a catalina attribute. I could not find documentation indicating something special was necessary at the Tomcat configuration level too.

有没有办法来避免设置 ASYNC_SUPPORTED = TRUE 中的每一个请求,以使异步的servlet 3.0处理Tomcat 7的?

Is there a way to avoid having to set ASYNC_SUPPORTED=true in each request to enable async servlet 3.0 processing in Tomcat 7?

推荐答案

一对夫妇的事情,首先检查:

A couple of things to check first:

请确保在请求操作也支持异步(如解决的答案之一的问题的任何过滤器你引用)。

Make sure any filters that operate on the request also support async (as addressed in one of the answers to the question you referenced).

请确保您使用一个Servlet 3.0 web.xml中 - 例如:

Make sure you're using a Servlet 3.0 web.xml - for example:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                             http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0"
         metadata-complete="true">

这篇关于如何避免ASYNC_SUPPORTED =请求集真在Tomcat 7中启用异步的servlet 3.0处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆