title: Java Spring: need wildcard @RequestMapping to match everything BUT /images/* with access to raw URL
body: <p>I'm new to Spring taking over existing code that uses @RequestMapping for various routes.  However, due to complexities of a new feature request, it would be much easier to bypass the Spring routing mechanism to have a single wildcard action method that matches all possible URLs EXCEPT for the asset directories:</p>
  
  <p>match these:</p>
  
  <blockquote>
    <p>(empty)<br>
    /<br>
    /anything/you/can/throw/at/it?a=b&amp;c=d</p>
  </blockquote>
  
  <p>but NOT:</p>
  
  <blockquote>
    <p>/images/arrow.gif<br>
    /css/project.css</p>
  </blockquote>
  
  <p>My various attempts either don't match at all or match but only capture a single word rather than the entire raw URL:</p>
  
  <pre><code>@RequestMapping(value="{wildcard:^(?!.*(?:images|css)).*\$}", method=RequestMethod.GET)
  public String index(@PathVariable("wildcard") String wildcard,
                      Model model) {
      log(wildcard); // =&gt; /anything/you/can/throw/at/it?a=b&amp;c=d
  }
  </code></pre>
  
  <p>(Various Google searches and Stackoverflow searches of "[spring] requestmapping wildcard" haven't helped so far.)</p>