0

In the Specification of Mapping section of Servlet specification, it was mentioned:

  • The empty string ("") is a special URL pattern that exactly maps to the application's context root, i.e., requests of the form http://host:port/<context-root>/. In this case the path info is / and the servlet path and context path is empty string ("").
  • A string containing only the / character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.

Based on the spec above, the empty string,"", and the "/" are different and maps to the different servlets.

However, I tried to test it on Wildfly server and found that no matter the URL pattern is set to empty string or "/", both can be mapped to the request URL http://host:port/<context-root>/ or http://host:port/<context-root> without the ending slash

Question: why does my test not get the result according to the Servlet Specification?

Rui
  • 3,454
  • 6
  • 37
  • 70

0 Answers0