Code example for URI

Methods: getPath

0
     * Extracts the path and the project ID from the DSN provided as an {@code URI}. 
     * 
     * @param dsnUri DSN as an URI. 
     */ 
    private void extractPathInfo(URI dsnUri) {
        String uriPath = dsnUri.getPath();
        if (uriPath == null)
            return; 
        int projectIdStart = uriPath.lastIndexOf("/") + 1;
        path = uriPath.substring(0, projectIdStart);
        projectId = uriPath.substring(projectIdStart);
    } 
 
    /** 
     * 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();