title: AsyncContext in Servlet 3.0 infinite browser loading
body: <p>I'm going to make streaming. I have .jsp file and at the end of .jsp file I include my Async Servlet using following code:</p>
  
  <pre><code>&lt;jsp:include page = '/simple' flush = 'true' /&gt;
  </code></pre>
  
  <p>So I want when whole page is loaded to open an infinite Async request, which will handle Async response.</p>
  
  <p>Here is my Servlet code:</p>
  
  <pre><code>public class SimpleAsyncServlet extends HttpServlet {
      public static AsyncContext ctx;
      protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
          req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
          ctx = req.startAsync();
          ctx.setTimeout(0);
      }
  }
  </code></pre>
  
  <p>From other java classes I'm using the static SimpleAsyncServlet.ctx.getResponse.getWriter() to println some javascript code to current page. It is working without any problem, but browser keep showing that it's loading. According to Async idea page should be loaded and this Async Request should stay alive in background and..that's it, but no....browser keeps loading the page till forever (timeout is 0, cos I want to have infinite open reqeust)</p>
  
  <p>Where am I wrong and how can I make this permanent request without this browser loading ?</p>
  
  <p>P.S. I have tried to access my servlet direct from url (localhost.../simple) and then I see nothing printed on page. It keep loading till forever.</p>