/**
  * Look up a handler instance for the given URL path.
  *
  * <p>Supports direct matches, e.g. a registered "/test" matches "/test", and various Ant-style
  * pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the
  * AntPathMatcher class.
  *
  * <p>Looks for the most exact pattern, where most exact is defined as the longest path pattern.
  *
  * <p><strong>Copied from AbstractUrlHandlerMapping</strong>
  *
  * @param urlPath URL the bean is mapped to
  * @return the associated handler instance, or <code>null</code> if not found
  * @see org.springframework.util.AntPathMatcher
  */
 protected Object lookupHandler(String urlPath, HttpServletRequest request) {
   if (rootHandler != null && urlPath.equals("/")) {
     return rootHandler;
   }
   Mapping bestMatch = null;
   for (Mapping mapping : mappings) {
     if (mapping.matches(urlPath) && mapping.isMoreSpecific(bestMatch)) {
       bestMatch = mapping;
     }
   }
   if (bestMatch != null) {
     bestMatch.pattern.expose(urlPath, request);
     exposeHandlerName(bestMatch.handlerName, request);
     return bestMatch.handler;
   }
   return null;
 }