Author: markt Date: Tue Oct 20 13:49:15 2009 New Revision: 827446 URL: http://svn.apache.org/viewvc?rev=827446&view=rev Log: Update example for updated Servlet 3.0
Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java?rev=827446&r1=827445&r2=827446&view=diff ============================================================================== --- tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java (original) +++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/AsyncStockServlet.java Tue Oct 20 13:49:15 2009 @@ -58,7 +58,7 @@ req.getAsyncContext().complete(); } else if (req.isAsyncSupported()) { AsyncContext actx = req.startAsync(); - req.addAsyncListener(this); + actx.addListener(this); resp.setContentType("text/plain"); clients.add(actx); if (this.clientcount.incrementAndGet()==1) { @@ -104,18 +104,25 @@ @Override public void onComplete(AsyncEvent event) throws IOException { - if (clients.remove(event.getRequest().getAsyncContext()) && clientcount.decrementAndGet()==0) { + if (clients.remove(event.getAsyncContext()) && clientcount.decrementAndGet()==0) { ticker.removeTickListener(this); } } @Override public void onError(AsyncEvent event) throws IOException { - event.getRequest().getAsyncContext().complete(); + event.getAsyncContext().complete(); } @Override public void onTimeout(AsyncEvent event) throws IOException { - event.getRequest().getAsyncContext().complete(); + event.getAsyncContext().complete(); + } + + + + @Override + public void onStartAsync(AsyncEvent event) throws IOException { + // NOOP } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org