private RailsController getController(RailsRoute rr) {
   String[] urlFolders = rr.getUrl().split("/");
   ArrayUtils.reverse(urlFolders);
   for (String urlFolder : urlFolders) {
     if (urlFolder.isEmpty()) continue;
     for (RailsController railsController : railsControllers) {
       String controllerField = railsController.getControllerField();
       if (controllerField.isEmpty()) continue;
       if (urlFolder.equalsIgnoreCase(controllerField)) {
         return railsController;
       }
     }
   }
   for (String urlFolder : urlFolders) {
     if (urlFolder.isEmpty()) continue;
     for (RailsController railsController : railsControllers) {
       for (RailsControllerMethod railsControllerMethod : railsController.getControllerMethods()) {
         String methodName = railsControllerMethod.getMethodName();
         if (urlFolder.equalsIgnoreCase(methodName)) {
           return railsController;
         }
       }
     }
   }
   return null;
 }
  private List<Endpoint> generateMappings() {
    List<Endpoint> mappings = list();
    for (RailsRoute railsRoute : routeMap.values()) {
      String urlPath = railsRoute.getUrl();
      Collection<String> httpMethods = railsRoute.getHttpMethods();
      String filePath = "";
      Collection<String> parameters = list();

      RailsController railsController = getController(railsRoute);
      if (railsController != null) {
        File f = railsController.getControllerFile();
        filePath = getRelativePath(f);
        parameters = railsController.getParameters();
        mappings.add(new RailsEndpoint(filePath, urlPath, httpMethods, parameters));
        //              mappings.add(new RailsEndpoint(urlPath + ".html.erb", urlPath, httpMethods,
        // parameters));
      }
    }
    return mappings;
  }