I am struggling with a webapp deployment in Jetty 6. Previously the the webapp was deployed in /mywebapp and everytime I accessed http://localhost/mywebapp/ Jetty directed me to http://localhost/mywebapp/index.jsp.
When I change the contextPath to /, suddenly the redirect behaviour is broken. Instead, Jetty makes an internal forward request.
Does anyone have any input why this is happening? The DefaultServlet has the following settings:
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>welcomeServlets</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>redirectWelcome</param-name>
<param-value>true</param-value>
</init-param>
Turns out it was not exactly the change of
contextPaththat made the redirects fail. Instead, I realized that simply the action of addingmywebapp.xmlinto$JETTY_HOME/contexts/made Jetty not execute the redirects.I overcame this issue by deleting my context XML file, instead renaming
$JETTY_HOME/webapps/mywebapp.warto$JETTY_HOME/webapps/root.warsolved the issue.Unclear why this happened in the first place, but I’m happy things are back on track.