title: Difference between / and /* in servlet mapping url pattern
body: <p>The familiar code: </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;main&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;main&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>My understanding is that <code>/*</code> maps to <code>http://host:port/context/*</code>.</p>
  
  <p>How about <code>/</code>? It sure doesn't map to <code>http://host:port/context</code> root only. In fact, it will accept <code>http://host:port/context/hello</code>, but reject <code>http://host:port/context/hello.jsp</code>.</p>
  
  <p>Can anyone explain how is <code>http://host:port/context/hello</code> mapped? </p>