On 04/04/2016 13:19, arjan tijms wrote:
> Hi,
>
> I wrote a small blog post about the new API
> here: http://arjan-tijms.omnifaces.org/2016/04/servlet-40s-mapping-api-previewed-in.html
>
> I think we need to discuss the "implicit" mapping. As by my experiments,
> Tomcat never seems to return it, even when calling a *.jsp page. It's
> debatable if implicit even is a separate mapping. I mean, can't we have
> an implicit path mapping, implicit extension mapping etc? Maybe it's
> better to have an isImplicit() method on the Mapping type?
Tomcat doesn't return it for several, overlapping, reasons.
The first is that whether or not the mapping is implicit is independent
of the mapping type. Taking the obvious *.jsp example, that is an
extension mapping as well as - in some containers - an implicit mapping.
The second is that Tomcat configures JSP handling via its default
web.xml. The default web.xml is treated a bit like a web.xml fragment
but with modified merging rules. It is arguable whether this is an
implicit mapping or one configured by the web application defaults.
Tomcat can't tell the difference (it could but the code might get ugly)
between a *.jsp mapping from the default web.xml and anything the web
application might specify.
What is the use case for being able to differentiate between an implicit
mapping and an application configured one? If there is one, isImplict()
is the way to go but I remain concerned that implicit mappings are a
grey area.
> I also got some feedback regarding the getPattern() method. People
> (also) seem to want the pattern in such a way that they can use it right
> away in their code. E.g. for path mapping the pattern would now be e.g.
> "/path/*", but it would also be desirable to have a "/path/" returned.
I see where you are going with this but getPattern() is meant to return
the pattern specified in web.xml.
Do we need another method? What is the relationship to getServletPath()?
> Another comment concerned the Default mapping. It's now e.g.:
>
> Default (fallback) mapping
> http://localhost:8080/servlet4/doesnotexist
>
> Mapping match:DEFAULT
> Match value:/
> Pattern:/
>
> Should the match value be "/" here, or perhaps better be "/doesnotexist"?
>
> What do you think?
Same questions as above really but with getPathInfo()
I'm more than happy to support adjustments to this API based on user
feedback but I do want to make sure that we aren't just duplicating
existing functionality.
At the moment, it feels more like the use case is meet by getMatchType()
and a combination of getServletPath() and getPathInfo() depending on the
match type and use case. At this point I'm not sure there is a single
return value that meets all use cases.
Mark