Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1415

Cross-context include call from another web app breaks HttpRequestContext cleanup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.14.Final, 2.0.2.Final
    • 2.0.0.Final
    • None
    • None

      It seems the following code is legal (alhough it's not very clear in the Servlet spec):

      // This servlet is part of CDI-enabled webapp1
      @WebServlet("/info1")
      public class InfoServlet1 extends HttpServlet {
          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              // CDI-enabled webapp2 contains InfoServlet2 mapped to /info2
              req.getServletContext().getContext("/webapp2").getRequestDispatcher("/info2").include(req, resp);
          }
      }
      

      The problem is the WeldListener in webapp2 cleans up bound request context (ThreadLocal bean store) after the InfoServlet2 processing is finished. Afterwards the request context deactivation in webapp1 results in NPE.

            rhn-engineering-jharting Jozef Hartinger
            mkouba@redhat.com Martin Kouba
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: