Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-357

Can't use the RequestDispatcher in a separate thread

    XMLWordPrintable

Details

    • Clarification
    • Resolution: Done
    • Minor
    • 1.2.0.CR1
    • 1.0.0.Final
    • Servlet
    • None

    Description

      Hi,

      I have a job running asynchronously which simulate an HTTP request to retrieve a resource exposed by the container.

      final RequestDispatcher rd = servletContext.getRequestDispatcher(path.charAt(0) == '/' ? path : '/' + path);
      rd.include(new HttpServletRequestWrapper(new MyHttpServletRequestAdapter()), new HttpServletResponseWrapper(myWrappedResponse));

      This will works if I run my code in the same thread as the real HTTP request because undertow checks that this request is actually bound to a ThreadLocal. Also note that everything works fine on tomcat for instance.

      What do you think? I think my approach is legal.

      Bye

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            gdrouet Guillaume Drouet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: