URIUtils.java 676 Bytes
package pl.it_crowd.youtrack.api;

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

public class URIUtils {
// -------------------------- STATIC METHODS --------------------------

    public static URI buildURI(URI base, String path)
    {
        return buildURI(base, path, null);
    }

    public static URI buildURI(URI base, String path, String query)
    {
        try {
            return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), base.getPath().replaceAll("/+$", "") + path, query,
                base.getFragment());
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }
}