Blame view

src/main/java/pl/itcrowd/youtrack/api/URIUtils.java 603 Bytes
bernard authored
1
package pl.itcrowd.youtrack.api;
bernard authored
2 3 4 5 6 7

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

public class URIUtils {
bernard authored
8 9 10 11
    public static URI buildURI(URI base, String path)
    {
        return buildURI(base, path, null);
    }
bernard authored
12
bernard authored
13 14 15 16 17 18 19 20
    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);
        }
bernard authored
21 22
    }
}