title: UrlRewriteFilter rule not working with servlet url
body: <p>I am trying to redirect old servlet urls to new ones with UrlRewriteFilter 4.0.3. I have a bunch of working rules but the one with a servlet url in <code>&lt;from&gt;&lt;/from&gt;</code> is not working.</p>
  
  <p>My rule looks like this:</p>
  
  <pre><code>&lt;rule&gt;
      &lt;from&gt;/servlet/OldServlet\?old_parameter=&amp;amp;id=([0-9]+)$&lt;/from&gt;
      &lt;to type="redirect"&gt;/servlet/NewServlet?new_parameter=&amp;amp;document_id=$1&lt;/to&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>I have tried to cut out pieces of the "from" with ".+". I managed to get the rule working by removing "?" from my url and rule. It seems that servlet urls are not matched to defined rules. OldServlet is still mapped in my web.xml for legacy reasons.</p>
  
  <p>EDIT:</p>
  
  <p><code>org.tuckey.web.filters.urlrewrite.UrlRewriter DEBUG: processing request for /servlet/OldServlet</code></p>
  
  <p>The url gets trimmed from "?".</p>
  
  <p>EDIT 2:</p>
  
  <p>UrlRewriter.java:</p>
  
  <pre><code>public String getPathWithinApplication(HttpServletRequest request) {
      String requestUri = request.getRequestURI();
      ...
  </code></pre>
  
  <p>It seems that UrlRewriteFilter uses a method that does not return the full url.</p>
  
  <p><a href="http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURI" rel="nofollow">http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURI</a>()</p>
  
  <blockquote>
    <p>Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. </p>
  </blockquote>