All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clarolab.bamboo.utils.UrlUtils Maven / Gradle / Ivy

package com.clarolab.bamboo.utils;

import java.net.URI;
import java.net.URISyntaxException;

public class UrlUtils {

    public static StringBuilder getEndpoint(String url){
        return new StringBuilder(removeHostFromUrl(url));
    }

    private static String removeHostFromUrl(String url) {
        try {
            StringBuilder urlWithOutHost = new StringBuilder(new URI(url).getPath());
            if (!urlWithOutHost.toString().endsWith("/")) urlWithOutHost.append('/');
            return urlWithOutHost.toString();
        } catch (URISyntaxException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy