Date
1 - 8 of 8
[73-MappingDiscovery] Not known or not knowable
Hello Volunteers,
Consider these methods in HttpServletMapping Spec> String getMatchValue() Return the portion of the URI path that Spec> caused this request to be matched or the empty String if not known Spec> or not knowable Spec> String getPattern() Return the String representation for the Spec> url-pattern for this mapping or the empty String if not known or not Spec> knowable. Spec> String getServletName() Return the String representation for the Spec> servlet-name for this mapping or the empty String if not known or Spec> not knowable. I propose we make the following changes relative to the above text. Drop the "or the empty String..." from all of these. For getServletName() add "Containers may return the empty String in the case of a DEFAULT or CONTEXT_ROOT match. Again the motivation for this change is the act of authoring rigorous TCK tests for this feature. ACTION: Please respond by COB GMT-0500 Friday 30 June 2017, otherwise I'll assume the above proposal is correct. Thanks, Ed -- | edward.burns@... | office: +1 407 458 0017 |
|
+1 from me.
I'm not really sure at all when a container would not known why it selected a Servlet. Especially since the parts of the request based on which this choice is made don't have such a mention in their javadoc at all. |
|
Greg Wilkins
+1 for me. On 28 June 2017 at 18:14, Edward Burns <edward.burns@...> wrote: Hello Volunteers, --
|
|
Mark Thomas
On 28/06/17 17:14, Edward Burns wrote:
Hello Volunteers,I can understand when a DEFAULT match may return "" for getServletName() - when the container provides this functionality without using an explicitly configured Servlet. But when can a CONTEXT_ROOT match do this? Doesn't that require explicit configuration in web.xml hence there should always be a servlet name? What am I missing? Mark
|
|
On 28/06/17 17:14, Edward Burns wrote:On Thu, 29 Jun 2017 21:46:02 +0100, "Mark Thomas" <markt@...> said: Spec> String getMatchValue() Return the portion of the URI path that Spec> caused this request to be matched or the empty String if not known Spec> or not knowable Spec> String getPattern() Return the String representation for the Spec> url-pattern for this mapping or the empty String if not known or not Spec> knowable. Spec> String getServletName() Return the String representation for the Spec> servlet-name for this mapping or the empty String if not known or Spec> not knowable. EB> I propose we make the following changes relative to the above text. EB> Drop the "or the empty String..." from all of these. EB> For getServletName() add "Containers may return the empty String in the EB> case of a DEFAULT or CONTEXT_ROOT match. MT> I can understand when a DEFAULT match may return "" for getServletName() MT> - when the container provides this functionality without using an MT> explicitly configured Servlet. MT> But when can a CONTEXT_ROOT match do this? Doesn't that require explicit MT> configuration in web.xml hence there should always be a servlet name? MT> What am I missing? Thank you so much for your prompt reply on this, Mark. In my automated test for the feature in GlassFish, if the WAR is deployed to the root context of the server such that the servlet is invoked with <http://localhost:8080> with no other path, I observe that servletName is the empty string. I also see the empty string when the WAR is not deployed to the root context, for example by deploying web-servlet-4.0-mapping-discovery-web.war to the default deployment of <http://localhost:8080/web-servlet-4.0-mapping-discovery-web>. The web.xml for that test, in the root context case, is at [1]. Mark, do you think the correct behavior in the CONTEXT_ROOT case of [1] is to return ServletC? Thanks, Ed -- | edward.burns@... | office: +1 407 458 0017 [1] https://github.com/javaee/glassfish/blob/master/appserver/tests/appserv-tests/devtests/web/servlet-4.0/mappingDiscovery/descriptor/web.xml |
|
Greg Wilkins
Surely the context path of a webapp should not affect the return from getServletName at all. Also, I thought that most containers have a default servlet deployed with a name "default". Jetty certainly does. cheers On 30 Jun. 2017 19:28, "Edward Burns" <edward.burns@...> wrote: >>>>> On Thu, 29 Jun 2017 21:46:02 +0100, "Mark Thomas" <markt@...> said: |
|
Mark Thomas
On 30/06/17 18:28, Edward Burns wrote:
<snip/>On Thu, 29 Jun 2017 21:46:02 +0100, "Mark Thomas" <markt@...> said: MT> I can understand when a DEFAULT match may return "" for getServletName()If it is ServletC that is providing the response, then yes. Mark |
|
EB> Mark, do you think the correct behavior in the CONTEXT_ROOT case of [1]On Sun, 2 Jul 2017 21:56:08 +0100, "Mark Thomas" <markt@...> said: EB> is to return ServletC? MT> If it is ServletC that is providing the response, then yes. To that end, here is the proposed text for HttpServletMapping.getServletName() [1]: public String getServletName() Return the String representation for the servlet-name for this mapping. If the Servlet providing the response is the default servlet, the return from this method is the name of the default servlet, which is container specific. Returns: the String representation for the servlet-name for this mapping. ------------------ I looked through the spec PDF and I did not see any text about the name of the default servlet, so this is why I think it is correct to say "container specific". ACTION: Please let me know if this is ok by close of business GMT-0500 Monday 20 July 2017. If I don't hear anything, I'll assume this is ok. Sincerely, Ed -- | edward.burns@... | office: +1 407 458 0017 [1] https://maven.java.net/service/local/repositories/snapshots/archive/javax/servlet/javax.servlet-api/4.0.0-b08-SNAPSHOT/javax.servlet-api-4.0.0-b08-20170703.172406-3-javadoc.jar/!/javax/servlet/http/HttpServletMapping.html |
|