Can you give a specific example of a mapping, and what happens with
the
> welcome file that is unexpected?
Presently, I'm setting require welcome files to true for all mappings
since it seemed to be required for the CFML servlet to work (which, so far
as I can tell, is very similar to how JSPs work), but then the
/flex2gateway/* mapping I mentioned above gets changed to
/flex2gateway/index.cfm when I hit it which means the default welcome file
is inserted in, but it shouldn't be for that mapping.
I just did a quick test commenting out this line that has always run for
each servlet
servlet.setRequireWelcomeFileMapping(true);
and while welcome files to seem to still work at first glance (which is
good), and the flex2gateway mapping no longer tries to force a welcome file
(which is also good), my directory listings stopped working in folders that
don't have a welcome file (which is bad). That last item is actually sort
of puzzling. Why would NOT requiring a welcome file mapping make my
directory listing URL try and force a welcome file even though it doesn't
exist?
That is odd, how are you doing the directory listing? Is it just via the
default servlet?
Thanks!
~Brad
*Developer Advocate*
*Ortus Solutions, Corp *
E-mail: brad(a)coldbox.org
ColdBox Platform:
http://www.coldbox.org
Blog:
http://www.codersrevolution.com
On Wed, Aug 14, 2019 at 9:38 AM Stuart Douglas <sdouglas(a)redhat.com>
wrote:
> Can you give a specific example of a mapping, and what happens with the
> welcome file that is unexpected?
>
> This is basically an internal flag to deal with two things that are
> treated differently by the spec.
>
> On Thu, 15 Aug. 2019, 12:26 am Brad Wood, <bdw429s(a)gmail.com> wrote:
>
>> 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(a)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(a)redhat.com>
>> wrote:
>>
>>>
>>>
>>> On Wed, 14 Aug 2019 at 23:26, Brad Wood <bdw429s(a)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(a)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(a)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.Fi...
>>>>>
>>>>>
>>>>> 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(a)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/...
>>>>>>
<
https://jar-download.com/artifacts/io.undertow/undertow-jsp/1.0.0.Beta27/...
>>>>>> )*
>>>>>>
>>>>>> 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(a)coldbox.org
>>>>>> ColdBox Platform:
http://www.coldbox.org
>>>>>> Blog:
http://www.codersrevolution.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> undertow-dev mailing list
>>>>>> undertow-dev(a)lists.jboss.org
>>>>>>
https://lists.jboss.org/mailman/listinfo/undertow-dev
>>>>>
>>>>>