static String path(String uri){
  int i=uri.indexOf("://");
  if (i == -1) {
    i=0;
  }
 else {
    i=uri.indexOf('/',i + 3);
    if (i == -1) {
      return "/";
    }
  }
  int queryStart=uri.indexOf('?',i);
  if (queryStart == -1) {
    queryStart=uri.length();
  }
  return uri.substring(i,queryStart);
}

static String path ( String uri ) { int i = uri . indexOf ( "://" ) ; if ( i == - 1 ) { i = 0 ; } else { i = uri . indexOf ( '/' , i + 3 ) ; if ( i == - 1 ) { return "/" ; } } int queryStart = uri . indexOf ( '?' , i ) ; if ( queryStart == - 1 ) { queryStart = uri . length ( ) ; } return uri . substring ( i , queryStart ) ; }
extract the path out of the uri .
