On Wed, 14 Aug 2019 at 23:26, Brad Wood <bdw429s@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 

ColdBox Platform: http://www.coldbox.org 



On Wed, Aug 14, 2019 at 12:57 AM Stuart Douglas <sdouglas@redhat.com> wrote:


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@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

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 

ColdBox Platform: http://www.coldbox.org 

_______________________________________________
undertow-dev mailing list
undertow-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev