I have created a servlet 3.0 to explore asynchronous request processing:
@WebServlet(name="MyTest", urlPatterns={"/MyTest"}, asyncSupported=true)
public class MyTest extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
AsyncContext tmp = req.startAsync(req, res);
...
}
}
but I get an IllegalStateException
when .startAsync(...)
is called. I know the Javadoc mentions that exception, but I did explicitly enable async (c.f. WebServlet
annotation). I am using Tomcat 7.0.11.0 delivered with NetBeans.
I could confirm that req.isAsyncSupported()
is returning false. What am I doing wrong? What more do I need to do to enable async processing?
EDIT:
I tried to implement the following example and got the same issue.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…