public static boolean isChildOf(Resource file,Resource dir){
  while (file != null) {
    if (file.equals(dir))     return true;
    file=file.getParentResource();
  }
  return false;
}

public static boolean isChildOf ( Resource file , Resource dir ) { while ( file != null ) { if ( file . equals ( dir ) ) return true ; file = file . getParentResource ( ) ; } return false ; }
check if file is a child of given directory
