code: public static String getCommonPrefixPath(String first, String second) {
  
          List<String> firstComponents = getPathComponents(first);
          List<String> secondComponents = getPathComponents(second);
          int minSize = Math.min(firstComponents.size(), secondComponents.size());
          StringBuffer resultBuffer = new StringBuffer();
          for (int i = 0; i < minSize; i++) {
              if (firstComponents.get(i).equals(secondComponents.get(i))) {
                  resultBuffer.append("/");
                  resultBuffer.append(firstComponents.get(i));
              } else {
                  break;
              }
          }
          String result = resultBuffer.toString();
          if (result.length() == 0) {
              result = "/";
          }
          return result;
      }
docs: Returns the common parent path of two paths.<p>
  
  <b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
  
  @param first the first path
  @param second the second path
  
  @return the common prefix path