Hi All,
I have written the below piece of code (NewServlet.java) to try the Servlet
3.0 async feature.
But it is failing by throwing up the below mentioned error.
Tomcat Version: 7.0.27 (32 bit)
OS: Windows 7
java.lang.IllegalStateException: Not supported.
at org.apache.catalina.connector.Request.startAsync(Request.java:1664)
at
org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1030)
at
javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:379)
code snippet:
try{
boolean asynSupported = request.isAsyncSupported();
System.out.println("asynSupported: "+asynSupported);
AsyncContext async = request.startAsync(request,
response); *//exception
is thrown at this point
* messageSender.addConnection(async);
AlertListener alertListener = new AlertListener(messageSender);
async.start(alertListener);
} catch (Throwable thr){
thr.printStackTrace();
}
web.xml snippet:
<servlet>
<servlet-name>NewServlet</servlet-name>
<servlet-class>sample.comet.NewServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
server.xml snippet :
<Connector connectionTimeout="20000" port="8084"
protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
Even the sample program "AsyncRequest" that comes with tomcat does not
work. :-( it also throws the same exception.