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

javax.servlet.*.mapping request attributes are not available in servlets forwarded with RequestDispatcher

XMLWordPrintable

    • Hide

      It can be reproduced in attached simple application test-app-src.zip:

      $ unzip test-app-src.zip
      $ cd test-app
      $./mvnw package
      $ cp target/ROOT.war JBOSS_EAP_749_HOME/standalone/deployments/
      $ JBOSS_EAP_749_HOME/bin/standalone.sh
      

      JBoss EAP 7.4.9 (actual):

      $ curl http://127.0.0.1:8080/dispatch
      request attributes:
      key: javax.servlet.forward.context_path, value: 
      key: javax.servlet.forward.servlet_path, value: /dispatch
      key: javax.servlet.forward.request_uri, value: /dispatch
      

      Tomcat 9.0.72 (expected):

      $ curl http://127.0.0.1:8080/dispatch
      request attributes:
      key: javax.servlet.forward.request_uri, value: /dispatch
      key: javax.servlet.forward.context_path, value: 
      key: javax.servlet.forward.servlet_path, value: /dispatch
      key: javax.servlet.forward.mapping, value: org.apache.catalina.core.ApplicationMapping$MappingImpl@2248cb0c  <<<===
      Show
      It can be reproduced in attached simple application test-app-src.zip: $ unzip test-app-src.zip $ cd test-app $./mvnw package $ cp target/ROOT.war JBOSS_EAP_749_HOME/standalone/deployments/ $ JBOSS_EAP_749_HOME/bin/standalone.sh JBoss EAP 7.4.9 (actual): $ curl http: //127.0.0.1:8080/dispatch request attributes: key: javax.servlet.forward.context_path, value: key: javax.servlet.forward.servlet_path, value: /dispatch key: javax.servlet.forward.request_uri, value: /dispatch Tomcat 9.0.72 (expected): $ curl http: //127.0.0.1:8080/dispatch request attributes: key: javax.servlet.forward.request_uri, value: /dispatch key: javax.servlet.forward.context_path, value: key: javax.servlet.forward.servlet_path, value: /dispatch key: javax.servlet.forward.mapping, value: org.apache.catalina.core.ApplicationMapping$MappingImpl@2248cb0c <<<===

      From Servlet 4.0 spec, request attribute javax.servlet.forward.mapping must be set in a forwarded servlet with RequestDispacher, but it is not set in JBoss EAP 7.4.9.

      https://javaee.github.io/servlet-spec/downloads/servlet-4.0/servlet-4_0_FINAL.pdf

      9.4.2 Forwarded Request Parameters
      ...
      The following request attributes must be set:

      • javax.servlet.forward.mapping <<<=== added from servlet 4.0
      • javax.servlet.forward.request_uri
      • javax.servlet.forward.context_path
      • javax.servlet.forward.servlet_path
      • javax.servlet.forward.path_info
      • javax.servlet.forward.query_string

            mshikalw Moulali Shikalwadi
            mshikalw Moulali Shikalwadi
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: