[undertow-dev] When to use RequireWelcomeFileMapping

Stuart Douglas sdouglas at redhat.com
Wed Aug 14 01:56:50 EDT 2019


This is mostly for JSP, as per the javadoc on the field:
https://jar-download.com/artifacts/io.undertow/undertow-servlet/2.0.24.Final/source-code/io/undertow/servlet/api/ServletInfo.java


Say we have mapped a JSP servlet to /jsp/*, and this directory contains a
file called index.jsp. Even though we have technically mapped to a servlet
we still want to perform a welcome file match to actually serve
/jsp/index.jsp via the welcome file mechanism. It's a similar story for the
default servlet, if there is an index.html it should serve that via a
welcome file.

You are unlikely to ever need this unless you have a servlet that processes
or serves resources and want to perform welcome file mappings.

Stuart

On Thu, 1 Aug 2019 at 07:28, Brad Wood <bdw429s at gmail.com> wrote:

> I have some questions about when I should be using the following:
>
> servletInfo.setRequireWelcomeFileMapping(true)
>
> I can't find any documentation or comments in the code that help me answer
> exactly what that setting does and when to use it.  I'm parsing a web.xml
> file and creating the proper deployment from it, but I'm unsure when to set
> the option above since there is no corresponding attribute or tag in a
> web.xml along those lines.
>
> I did find this comment in a code sample online
>
> //if the JSP servlet is mapped to a path that ends in /*
> //we want to perform welcome file matches if the directory is requested
>
> *(
> https://jar-download.com/artifacts/io.undertow/undertow-jsp/1.0.0.Beta27/source-code/io/undertow/jsp/JspServletBuilder.java
> <https://jar-download.com/artifacts/io.undertow/undertow-jsp/1.0.0.Beta27/source-code/io/undertow/jsp/JspServletBuilder.java>
> )*
>
> but my app server has more than one servlet mapping with URL filters
> ending with /* and the welcome file list should only apply to one of them
> so it doesn't seem correct that ALL url filters ending in /* should set
> that. I'm unclear on whether the welcome files are attempted up front or
> only if a matching url filter isn't found.
>
> Thanks!
>
> ~Brad
>
> *Developer Advocate*
> *Ortus Solutions, Corp *
>
> E-mail: brad at coldbox.org
> ColdBox Platform: http://www.coldbox.org
> Blog: http://www.codersrevolution.com
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20190814/73090667/attachment.html 


More information about the undertow-dev mailing list