Code example for URL

Methods: getHost, getPort, getProtocol

0
        String protocol = "";
        String host = "";
        int port = 0;
 
        try { 
            URL url = new URL(urlString);
            protocol = url.getProtocol();
            host = url.getHost();
            if (url.getPort() > -1) {
                port = url.getPort();
            } 
        } catch (MalformedURLException e) {
            Log.e(LOG_TAG, "urlString=" + urlString + " databaseIdentifier=" + databaseIdentifier,
                    e);
        } 
 
        output.append("UI DELEGATE DATABASE CALLBACK: ");
        output.append("exceededDatabaseQuotaForSecurityOrigin:{");
        output.append(protocol + ", " + host + ", " + port + "} ");
        output.append("database:" + databaseIdentifier + "\n");
    }