<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>I noticed there&#39;s a difference in behaviour between JBossWeb/Tomcat and Undertow with respect to welcome files.<br><br></div>Given a request to / and a welcome file set to /index<br>
<br></div>JBossWeb wil return &quot;/&quot; when HttpServletRequest#getRequestURI is called, and &quot;/index&quot; when HttpServletRequest#getServletPath is called.<br><br></div>Undertow will return &quot;/index&quot; in both cases.<br>
<br></div>It&#39;s clear what happens by looking at ServletInitialHandler#handleRequest which does a full rewrite for welcome files:<br><br>   exchange.setRelativePath(exchange.getRelativePath() + info.getRewriteLocation());<br>
            exchange.setRequestURI(exchange.getRequestURI() + info.getRewriteLocation());<br>            exchange.setRequestPath(exchange.getRequestPath() + info.getRewriteLocation());<br><br></div>The Servlet spec (10.10) does seem to justify this somewhat by saying the following:<br>
<br>&quot;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.&quot;<br><br></div>However, the JavaDoc for HttpServletRequest#getRequestURI doesn&#39;t seem to allow this.<br>
<br></div>At any length, it&#39;s a nasty difference that breaks various things.<br><br></div>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?<br>
<br></div>Kind regards,<br>Arjan <br></div>