private String cannonicalPage(String url){
  String cannonical="";
  if (url.startsWith(HTTP_PROTOCOL)) {
    url=url.substring(HTTP_PROTOCOL.length());
  }
 else   if (url.startsWith(HTTPS_PROTOCOL)) {
    url=url.substring(HTTPS_PROTOCOL.length());
  }
  int urlLength=url.length();
  for (int i=0; i < urlLength; i++) {
    if (url.charAt(i) != '/')     cannonical+=url.charAt(i);
 else     break;
  }
  return cannonical;
}

private String cannonicalPage ( String url ) { String cannonical = "" ; if ( url . startsWith ( HTTP_PROTOCOL ) ) { url = url . substring ( HTTP_PROTOCOL . length ( ) ) ; } else if ( url . startsWith ( HTTPS_PROTOCOL ) ) { url = url . substring ( HTTPS_PROTOCOL . length ( ) ) ; } int urlLength = url . length ( ) ; for ( int i = 0 ; i < urlLength ; i ++ ) { if ( url . charAt ( i ) != '/' ) cannonical += url . charAt ( i ) ; else break ; } return cannonical ; }
returns the cannoncial url
