JBoss Community

jboss 7.1.1: asynclistener onErorr not called while closing browser

created by ksl in JBoss AS 7 Development - View the full discussion

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

Start a new discussion in JBoss AS 7 Development at Community