title: Find out actual URL pattern match when servlet is mapped on multiple URL patterns
body: <p>I've a list of links:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;a href="index"&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="contactus"&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="services"&gt;Services&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="enquire"&gt;Enquire&lt;a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>And the following servlet:</p>
  
  <pre><code>@WebServlet( urlPatterns={"/index","/contactus","/services","/enquire"})
  public class IndexServlet extends HttpServlet {
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws            ServletException, IOException {
  
  
     //Index URL mapping should be checked here like
  
     if(request.getRequestURL().equals("/index"))
     {
         response.sendredirtect("index.jsp")
     }
  
     //Url for contact  us should be checked here
  
  
     if(request.getRequestURL().equals("/contactus"))
     {
         response.sendredirtect("contactus.jsp")
     }
  
     //same for all the above url requests
  </code></pre>
  
  <p>}</p>
  
  <p>As the <code>getRequestURL()</code> method is a <code>StringBuffer</code>, it can not be checked for equality with the String <code>"/"</code>. </p>
  
  <p>How can I achieve this anyway?</p>