title: Modify HttpServletRequest before any HandlerMapping?
body: <p>The problem I am trying to solve is that I want to check all incoming GET urls against a database. If the the url exist in the database it shall be passed to a certein controller. I'm using Spring 3.0.</p>
  
  <p>First I tried to make an <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-handlermapping-interceptor" rel="nofollow noreferrer">interceptor</a> and add that to DefaultAnnotationsHandlerMapping. Turns out i couldn't modify the url in preHandle(). The plan was to modify the url in the request and then let an annotated controller handle the rest.</p>
  
  <p>Next I tried to make a custom HandleMapping. I extended <a href="http://static.springsource.org/spring/docs/3.0.0.RELEASE/api/org/springframework/web/servlet/handler/AbstractHandlerMapping.html" rel="nofollow noreferrer">AbstractUrlHandlerMapping</a> and made my own getHandlerInternal() that returns a String with the name of the Controller and this is working. But I'd prefer a solution where I can modify the url in the request and let an annotated controller handle it.</p>
  
  <p>While writing this I got thinking that maybe a servlet filter is the most proper solution. If that's the case can I get Spring to inject an EntityManager into the filter? Any Spring class I can extend that makes this easier?</p>
  
  <p>What's the most proper way to solve the problem in the first paragraph? If it's the servlet filter please give me some pointers on how to write it. </p>