public static String getPage ( String url ) { try { // get the full url, and replace the query string with and empty // string url = url . toLowerCase ( Locale . ROOT ) ; String queryStr = new URL ( url ) . getQuery ( ) ; return ( queryStr != null ) ? url . replace ( "?" + queryStr , "" ) : url ; } catch ( MalformedURLException e ) { return null ; } }
Returns the page for the url . The page consists of the protocol host and path but does not include the query string . The host is lowercased but the path is not .