Code example for URI

Methods: getHost, getPort

0
     * Extracts the hostname and port of the Sentry server from the DSN provided as an {@code URI}. 
     * 
     * @param dsnUri DSN as an URI. 
     */ 
    private void extractHostInfo(URI dsnUri) {
        host = dsnUri.getHost();
        port = dsnUri.getPort();
    } 
 
    /** 
     * Extracts the scheme and additional protocol options from the DSN provided as an {@code URI}. 
     * 
     * @param dsnUri DSN as an URI. 
     */ 
    private void extractProtocolInfo(URI dsnUri) {
        String scheme = dsnUri.getScheme();
        if (scheme == null)
            return; 
        String[] schemeDetails = scheme.split("\\+");
        protocolSettings.addAll(Arrays.asList(schemeDetails).subList(0, schemeDetails.length - 1));
        protocol = schemeDetails[schemeDetails.length - 1];