<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>I noticed there'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 "/" when HttpServletRequest#getRequestURI is called, and "/index" when HttpServletRequest#getServletPath is called.<br><br></div>Undertow will return "/index" in both cases.<br>
<br></div>It'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>"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."<br><br></div>However, the JavaDoc for HttpServletRequest#getRequestURI doesn't seem to allow this.<br>
<br></div>At any length, it'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>