code: private AbstractHTTPDestination findDestination(HttpServletRequest req, Bus bus) throws ServletException
     {
        // Find destination based on request URI
        String requestURI = req.getRequestURI();
        DestinationRegistry destRegistry = getDestinationRegistryFromBus(bus);
        if (destRegistry == null)
        {
           throw Messages.MESSAGES.cannotObtainRegistry(DestinationRegistry.class.getName());
        }
        requestURI = pathPattern.matcher(requestURI).replaceAll("/");
        //first try looking up the destination in the registry map
        final AbstractHTTPDestination dest = destRegistry.getDestinationForPath(requestURI, true);
        if (dest != null) {
           return dest;
        }
        //if there's no direct match, iterate on the destinations to see if there's valid "catch-all" destination
        //(servlet-based endpoints, with "/*" url-pattern in web.xml)
        Collection<AbstractHTTPDestination> destinations = destRegistry.getDestinations();
        AbstractHTTPDestination returnValue = null;
        for (AbstractHTTPDestination destination : destinations)
        {
           String path = destination.getEndpointInfo().getAddress();
           try
           {
              path = new URL(path).getPath();
           }
           catch (MalformedURLException ex)
           {
              // ignore
              Logger.getLogger(RequestHandlerImpl.class).trace(ex);
           }
  
           if (path != null && requestURI.startsWith(path)) {
              returnValue = destination;
           }
        }
  
        if (returnValue == null)
           throw Messages.MESSAGES.cannotObtainDestinationFor(requestURI);
  
        return returnValue;
     }
docs: Finds destination based on request URI
  @param requestURI to be recognized
  @return destination associated with the request URI
  @throws ServletException when destination wasn't found