title: What is the base open source java package to filter/match URLs?
body: <p>I have an high performance application which deals with URLs. For every URL it needs to retrieve the appropriate settings from a predefined pool. Every settings object is associated with a URL pattern which indicates which URLs should use these settings. The matching rules are as follows:</p>
  
  <ol>
  <li>"google.com" match pattern should match all URLs pointing to the google domain (thus, maps.google.com and www.google.com/match are matched). </li>
  <li>"*.google.com" should match all URLs pointing to a subdomain of google.com (thus, maps.google.com matches, but google.com and www.google.com don't).</li>
  <li>"maps.google.com" should match all URLs pointing to this specific subdomain. </li>
  </ol>
  
  <p>Apart from the above rules, every match rule can contain a path, which means that the path part of the URL should start with the match rule path. So: "*.google.com/maps" matches "maps.google.com/maps" but not "maps.google.com/advanced".</p>
  
  <p>As you can see the rules above are overlapping. In the case two rules exist which match the same URL the most specific should apply. The list above is ranked from least specific to most specific.</p>
  
  <p>This seems to be such a standard problem that I was hoping to use a ready made library rather than program my self. Google reveals a couple of options but without a clear way to choose between them. What would you recommend as a good library for this task?</p>
  
  <p>Thanks,
  Boaz</p>