[wildfly-dev] getRequestURI returns welcome file instead of original request

arjan tijms arjan.tijms at gmail.com
Fri Jun 6 12:11:42 EDT 2014


I noticed there's a difference in behaviour between JBossWeb/Tomcat and
Undertow with respect to welcome files.

Given a request to / and a welcome file set to /index

JBossWeb wil return "/" when HttpServletRequest#getRequestURI is called,
and "/index" when HttpServletRequest#getServletPath is called.

Undertow will return "/index" in both cases.

It's clear what happens by looking at ServletInitialHandler#handleRequest
which does a full rewrite for welcome files:

exchange.setRelativePath(exchange.getRelativePath() +
exchange.setRequestURI(exchange.getRequestURI() +
exchange.setRequestPath(exchange.getRequestPath() +

The Servlet spec (10.10) does seem to justify this somewhat by saying the

"The container may send the request to the welcome resource with a forward,
a redirect, or a container specific mechanism that is indistinguishable
from a direct request."

However, the JavaDoc for HttpServletRequest#getRequestURI doesn't seem to
allow this.

At any length, it's a nasty difference that breaks various things.

Wonder what the general opinion is about this. Was it a conscious decision
to do a full rewrite in Undertow, or was it something that slipped through?

Kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/wildfly-dev/attachments/20140606/53e98e5c/attachment.html 

More information about the wildfly-dev mailing list