org.linkedin.util-core/src/main/java/org/linkedin/util/url/URLBuilder.java
public void appendPath(String path, boolean encodePath)
  {
    if(path == null)
      return;

    if(encodePath)
      path = urlEncode(path);

    if(path.startsWith("/"))
      path = path.substring(1);

    if(_path == null || "".equals(_path))
    {
      StringBuilder sb = new StringBuilder("/");
      sb.append(path);
      _path = sb.toString();
    }
    else
    {
      StringBuilder sb = new StringBuilder(_path);

      if(_path.endsWith("/"))
        sb.append(path);
      else
        sb.append('/').append(path);

      _path = sb.toString();
    }
  }
public void appendPath(String path, boolean encodePath)
  {
    if(path == null)
      return;

    if(encodePath)
      path = urlEncode(path);

    if(path.startsWith("/"))
      path = path.substring(1);

    if(_path == null || "".equals(_path))
    {
      StringBuilder sb = new StringBuilder("/");
      sb.append(path);
      _path = sb.toString();
    }
    else
    {
      StringBuilder sb = new StringBuilder(_path);

      if(_path.endsWith("/"))
        sb.append(path);
      else
        sb.append('/').append(path);

      _path = sb.toString();
    }
  }
Appends the given path. The path is conditionaly escaped.
After this call, <code>newpath = oldpath + / + path</code>.
As a consequence, this method cannot be used to set a relative path.

@param path the path to append
@param encodePath <code>true</code> to encode the path