Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160807

ServletRequest startSync()

XMLWordPrintable

      FULL PRODUCT VERSION :
      jdk 8

      ADDITIONAL OS VERSION INFORMATION :
      Windows Windows[Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Hello.The servlet below should throw IllegalStateException in case we don't specify asyncSupported=true.But it doesn't.

      //Async is unsupported for this servlet

      public class AsyncServlet extends HttpServlet {

          public void processRequest(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              response.setContentType("text/html;charset=UTF-8");
              PrintWriter out = response.getWriter();
              out.println(request.isAsyncSupported());
              AsyncContext aContext = request.startAsync();// it should throw IllegalStateException on this line.
              out.println("Java Servlet bug");
          }

          @Override
          protected void doGet(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              processRequest(request, response);
          }

          @Override
          protected void doPost(HttpServletRequest request, HttpServletResponse response)
                  throws ServletException, IOException {
              processRequest(request, response);
          }

      }


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      out.println(request.isAsyncSupported());
              AsyncContext aContext = request.startAsync(); // it should throw IllegalStateException on this line.whether request.isAsyncSupported() is called
              out.println("Java Servlet bug");

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it should throw IllegalStateException .whether request.isAsyncSupported() is called
      ACTUAL -
      Only "false" printed on browser.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      out.println(request.isAsyncSupported());
              AsyncContext aContext = request.startAsync(); // it should throw IllegalStateException on this line.whether request.isAsyncSupported() is called
              out.println("Java Servlet bug");
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: