[undertow-dev] When to use RequireWelcomeFileMapping

Brad Wood bdw429s at gmail.com
Wed Aug 14 10:26:45 EDT 2019


I'm not sure you're understanding the problem domain.  The web.xml I
provided was just an example, but I'm not creating the web.xml files nor do
I have any control over them.  My users provide their own war to run on my
Undertow-powered server tool and it's my job to parse their web.xml (with
whatever they have in it) and create the proper deployment on-the-fly
without any mind reading.

You seem to be describing an impossible scenario.  If Undertow has chosen
to require a special setting, unique to it and not a part of the web.xml
spec, yet there is no algorithm to externally decide when to use this
setting, how am I to use Undertow to dynamically start wars up without
insider knowledge on their mappings?  How does Wildfly handle this?

Thanks!

~Brad

*Developer Advocate*
*Ortus Solutions, Corp *

E-mail: brad at coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com



On Wed, Aug 14, 2019 at 9:04 AM Stuart Douglas <sdouglas at redhat.com> wrote:

>
>
> On Wed, 14 Aug 2019 at 23:26, Brad Wood <bdw429s at gmail.com> wrote:
>
>> Thanks for the reply Stuart.  The javadoc isn't really prescriptive
>> enough however.  I'm parsing a web.xml and adding servlets dynamically.  In
>> that manner, how would I know if a given servlet was going to serve JSPs or
>> was the default servlet?
>>
>
> This does not have a web.xml equivalent. JSP and default servlets have
> special behaviour as per the spec, but there is no spec defined way of
> having similar behaviour for other servlets.
>
>
>>
>> You are unlikely to ever need this unless you have a servlet that
>>> processes or serves resources and want to perform welcome file mappings.
>>
>>
>> Well, yes, that actually applies to me :) I'm using Undertow to start up
>> ColdFusion servers which in addition to usually running JSP if you want,
>> use wildcard mappings and have welcome files.  A ColdFusion server has
>> several mappings in place though.  In addition to the wildcard ones similar
>> to *.cfm or /index.cfm/* it also has mappings for /flex2gateway/* and I'm
>> seeing incorrect behavior where my welcome files are getting crammed into
>> the flex gateway URLs where they don't belong, thus my question.
>>
>> But my code isn't manually creating the mappings.  Like I said above, I'm
>> parsing a web.xml and adding the mappings dynamically, which puts me back
>> to my original question.  I don't think RequireWelcomeFileMapping should be
>> set for all mappings, but I'm unclear on how to tell the difference
>> programmatically.  How do other servlets such as Tomcat handle this when
>> loading my mappings from my web.xml?
>>
>> I'm attaching an example web.xml so you can see what I'm talking about.
>>
>
> This is an Undertow specific thing, I assume other containers have their
> own internal way of handling it.
>
> If you really want something like this define a special init param that
> servlets can use in web.xml to enable the behaviour.
>
> Stuart
>
>
>>
>> Thanks!
>>
>> ~Brad
>>
>> *Developer Advocate*
>> *Ortus Solutions, Corp *
>>
>> E-mail: brad at coldbox.org
>> ColdBox Platform: http://www.coldbox.org
>> Blog: http://www.codersrevolution.com
>>
>>
>>
>> On Wed, Aug 14, 2019 at 12:57 AM Stuart Douglas <sdouglas at redhat.com>
>> wrote:
>>
>>> 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/600edefb/attachment-0001.html 


More information about the undertow-dev mailing list