code: public String getRequestPath() {
          StringBuilder builder;
  
          synchronized (tryLock) {
              builder = new StringBuilder(path.length() + 10);
              builder.append('/');
              if (!path.isEmpty()) {
                  try {
                      builder.append(new URI(null, null, path, null).getRawPath());
                  } catch (URISyntaxException e) {
                      throw new IllegalStateException();
                  }
                  if (tryDir) {
                      builder.append('/');
                  }
              }
              if (encodedQuery != null) {
                  builder.append('?');
                  builder.append(encodedQuery);
              }
          }
          return builder.toString();
      }
docs: see http://tools.ietf.org/html/rfc2616#section-5.1.2