/**
  * Checks for an existing route that matches the {@link er.rest.routes.ERXRoute.Method} and {@link
  * er.rest.routes.ERXRoute#routePattern()} of <code>route</code> and yet has a different
  * controller or action mapping.
  *
  * @param route
  */
 protected void verifyRoute(ERXRoute route) {
   ERXRoute duplicateRoute =
       routeForMethodAndPattern(route.method(), route.routePattern().pattern());
   if (duplicateRoute != null) {
     boolean isDifferentController =
         ObjectUtils.notEqual(duplicateRoute.controller(), route.controller());
     boolean isDifferentAction = ObjectUtils.notEqual(duplicateRoute.action(), route.action());
     if (isDifferentController || isDifferentAction) {
       // We have a problem whereby two routes with same url pattern and http method map to
       // different direct actions
       StringBuilder message = new StringBuilder();
       message.append("The route <");
       message.append(route);
       message.append("> conflicts with existing route <");
       message.append(duplicateRoute);
       message.append(">.");
       if (isDifferentController) {
         message.append(" The controller class <");
         message.append(route.controller());
         message.append("> is different to <");
         message.append(duplicateRoute.controller());
         message.append(">.");
       }
       if (isDifferentAction) {
         message.append(" The action <");
         message.append(route.action());
         message.append("> is different to <");
         message.append(duplicateRoute.action());
         message.append(">.");
       }
       throw new IllegalStateException(message.toString());
     }
   }
 }
 /**
  * @param method
  * @param urlPattern
  * @return the first route matching <code>method</code> and <code>pattern</code>.
  */
 protected ERXRoute routeForMethodAndPattern(ERXRoute.Method method, String urlPattern) {
   for (ERXRoute route : _routes) {
     if (route.method().equals(method) && route.routePattern().pattern().equals(urlPattern)) {
       return route;
     }
   }
   return null;
 }