title: Why Doesn't Tuckey UrlRewrite Filter call chain.doFilter after a rule is matched?
body: <p>Using Spring Framework here...</p>
  
  <p>I created a filter to change the response body of css files and if I call a url directly it runs.  However, if a urlrewrite rule is matched the filter is skipped.</p>
  
  <p><strong>Example:</strong>
  In web.xml:</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;
      &lt;!-- skipping init params here for brevity --&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;cssFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
      &lt;filter-mapping&gt;
      &lt;filter-name&gt;cssFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;*css&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>There is a mapping set up like this in urlrewrite.xml:</p>
  
  <pre><code>&lt;rule&gt;
      &lt;from&gt;/styles-special/(.*)$&lt;/from&gt;
      &lt;to last="true"&gt;/styles/$1&lt;/to&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>(we need this for a number of reasons)</p>
  
  <p>so, any *.css file whose path starts w/ "/styles-special/" will be rewritten to "/styles/" and the cssFilter won't be called, but any *.css file whose path starts w/ "/styles/" will run through the cssFilter as expected.</p>
  
  <p>I've tried changing the url-pattern for cssFilter to a number of different options, but same result.  It seems to me like the tuckey urlrewrite filter just doesn't call chain.doFilter() after a rewrite, but maybe it's more complicated than that?</p>
  
  <p>Any idea what the issue might be here?  Is this expected functionality?  Any workarounds?  ...maybe an interceptor or controller is the way to go here?  </p>
  
  <p>Thanks in advance for any advice on this!! </p>
  
  <hr>
  
  <p>Note: Using the following (as suggested by axtavt):</p>
  
  <pre><code>&lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
  &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;
  </code></pre>
  
  <p>Fixes the issue w/ chaining and the Filter is run.  However, I get the following error:</p>
  
  <pre><code>java.lang.IllegalStateException: NO CONTENT
  at org.mortbay.jetty.HttpGenerator.addContent(HttpGenerator.java:106)
  at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:644)
  at org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:579)
  </code></pre>
  
  <p>Here's code snippet from Filter:</p>
  
  <pre><code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
      HttpServletRequest httpRequest = (HttpServletRequest) request;
      HttpServletResponse httpResponse = (HttpServletResponse) response;
  
      OutputStream out = httpResponse.getOutputStream();
      GenericResponseWrapper wrapper = new GenericResponseWrapper(httpResponse);
  
      chain.doFilter(request, wrapper);
  
      if(log.isDebugEnabled()) log.debug("doFilter: chain");
  
      String respBody = new String(wrapper.getData()); // this throws error
  ...
  </code></pre>