code: public static String toSlug(String pathPiece){
          String s = pathPiece.replaceAll("\\s+", "-").toLowerCase();
          s = s.replaceAll("[^\\w-_/]", "");
          return s;
      }
docs: Converts a String to a URL-safe, or 'slug' version. This converts the input to lowercase and replaces all
  characters with dashes (-) except for alphaneumerics, dashes (-), underscores (_), and forward slashes (/).
  
  @param pathPiece the input to 'slugify'
  @return the URL-safe slug