code: private static String mergeRealPathes(Mapping mapping, String parentRealPath, String newRealPath, RefBoolean isOutSide) {
  	parentRealPath = pathRemoveLast(parentRealPath, isOutSide);
  	while (newRealPath.startsWith("../")) {
  	    parentRealPath = pathRemoveLast(parentRealPath, isOutSide);
  	    newRealPath = newRealPath.substring(3);
  	}
  
  	// check if come back
  	String path = parentRealPath.concat("/").concat(newRealPath);
  
  	if (path.startsWith("../")) {
  	    int count = 0;
  	    do {
  		count++;
  		path = path.substring(3);
  	    }
  	    while (path.startsWith("../"));
  
  	    String strRoot = mapping.getPhysical().getAbsolutePath().replace('\\', '/');
  	    if (!StringUtil.endsWith(strRoot, '/')) {
  		strRoot += '/';
  	    }
  	    int rootLen = strRoot.length();
  	    String[] arr = ListUtil.toStringArray(ListUtil.listToArray(path, '/'), "");// path.split("/");
  	    int tmpLen;
  	    for (int i = count; i > 0; i--) {
  		if (arr.length > i) {
  		    String tmp = '/' + list(arr, 0, i);
  		    tmpLen = rootLen - tmp.length();
  		    if (strRoot.lastIndexOf(tmp) == tmpLen && tmpLen >= 0) {
  			StringBuffer rtn = new StringBuffer();
  			while (i < count - i) {
  			    count--;
  			    rtn.append("../");
  			}
  			isOutSide.setValue(rtn.length() != 0);
  			return (rtn.length() == 0 ? "/" : rtn.toString()) + list(arr, i, arr.length);
  		    }
  		}
  	    }
  	}
  	return parentRealPath.concat("/").concat(newRealPath);
      }
docs: merge to realpath to one
  
  @param mapping
  @param parentRealPath
  @param newRealPath
  @param isOutSide
  @return merged realpath