[jboss-dev-forums] [JBoss AS 7 Development] - jboss 7.1.1: asynclistener onErorr not called while closing browser

ksl do-not-reply at jboss.com
Sat Sep 1 05:41:44 EDT 2012


ksl [https://community.jboss.org/people/ksl] created the discussion

"jboss 7.1.1: asynclistener onErorr not called while closing browser"

To view the discussion, visit: https://community.jboss.org/message/757406#757406

--------------------------------------------------------------
I am testing simple application in jboss 7.1.1 final and servlet 3.0 feature. inside doGet/doPost I am starting AsynContext and adding the AsyncListener().

now when I am closing the browser, I am expecting it will hit the onError method, but it never.

 where i am going wrorng? 

--------code abstract----------------------
-


@WebServlet(urlPatterns = "/myPage", asyncSupported=true)
public class MyActionServlet extends HttpServlet { 

    public MyActionServlet(){
        
    }
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
    
         process(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        
        
        process(req,resp);
     }
    
    private void process(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("Hello world");
        req.getSession();
        AsyncContext async = req.startAsync();        
         async.addListener(new AsyncListener() {
            
            @Override
            public void onTimeout(AsyncEvent event) throws IOException {
                System.out.println("onTimeout:event::"+event);
                 
                
                
            }
            
            @Override
            public void onStartAsync(AsyncEvent arg0) throws IOException {
                System.out.println("onstart::");
                 
            }
            
            @Override
            public void onError(AsyncEvent event) throws IOException {
            System.out.println("onError.."+event);
                
             }
            
            @Override
            public void onComplete(AsyncEvent event) throws IOException {
                System.out.println("onComplete::"+event);
                
             }
        });
    
        
    }
}
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/757406#757406]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120901/1d5fe0c3/attachment.html 


More information about the jboss-dev-forums mailing list