Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2388

Calling getRequestURI() returns wrong address for root URL of webapp

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.0.0.CR1
    • 8.0.0.Beta1
    • Web (Undertow)
    • None
    • Hide
      • Deploy the attached sample app.
      • Navigate to http://localhost:8080/start-page/
      • You will see this in the browser window:
        • HttpServletRequest.getRequestURI() = /start-page/index.jsp
      • Correct result would be:
        • HttpServletRequest.getRequestURI() = /start-page/
      Show
      Deploy the attached sample app. Navigate to http://localhost:8080/start-page/ You will see this in the browser window: HttpServletRequest.getRequestURI() = /start-page/index.jsp Correct result would be: HttpServletRequest.getRequestURI() = /start-page/
    • Compatibility/Configuration

      Reading HttpServletRequest.getRequestURI() from a servlet filter gives incorrect result if requesting the root URL of a webapp:

      Requested URL getRequestURI() Correct?
      http://localhost:8080/myapp/foobar /myapp/foobar OK
      http://localhost:8080/myapp/ /myapp/index.jsp Incorrect! Should be /myapp/

      It seems like the filter sees the name of the welcome page instead of the incoming request URL. That's not correct.

      I tested this with other containers like Tomcat, AS7 and Glassfish and all of them show the incoming request URL instead.

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              christian@kaltepoth.de Christian Kaltepoth (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: