code: public static boolean isChildOf(Resource file, Resource dir) {
  	while (file != null) {
  	    if (file.equals(dir)) return true;
  	    file = file.getParentResource();
  	}
  	return false;
      }
docs: check if file is a child of given directory
  
  @param file file to search
  @param dir directory to search
  @return is inside or not