title: URL patterns in web.xml too permissive?
body: <p>I have a servlet with <code>web.xml</code> as follows:</p>
  
  <pre><code>&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    id="WebApp_ID" version="3.0"&gt;
    &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;/&lt;/welcome-file&gt;
    &lt;/welcome-file-list&gt;
    &lt;servlet&gt;
      &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.mydomain.myapp.MyServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;myservlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/rest1*&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/rest2*&lt;/url-pattern&gt;
      &lt;url-pattern&gt;/rest3*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>Ultimately, the servlet should support REST calls like <code>GET</code> from <code>http://myserver/myapp/rest1?param=1</code>.</p>
  
  <p>However, what happens is that all invocations of URLs that start with <code>http://myserver/myapp/</code> from a browser apparently lead to calls to the servlet's <code>doGet()</code> method with <code>request.pathInfo() == null</code>.</p>
  
  <p>But then, with the given <code>url-pattern</code>s, should the URL <code>http://myserver/myapp/rest1?param=1</code> not lead to <code>"/rest1".equals(request.pathInfo())</code> and should a URL pattern such as <code>http://myserver/myapp/foo</code> not lead to HTTP response 404 from the servlet?</p>
  
  <p>The servlet is running on Apache Tomcat 9.</p>