Blame view

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

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

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