private static URI relativize(URI base, URI child) { // check if child if opaque first so that NPE is thrown // if child is null. if (child.isOpaque() || base.isOpaque()) return child; if (!equalIgnoringCase(base.scheme, child.scheme) || !equal(base.authority, child.authority)) return child; String bp = normalize(base.path); String cp = normalize(child.path); if (!bp.equals(cp)) { if (!bp.endsWith("/")) bp = bp + "/"; if (!cp.startsWith(bp)) return child; } URI v = new URI(); v.path = cp.substring(bp.length()); v.query = child.query; v.fragment = child.fragment; return v; }
private static URI relativize(URI base, URI child) { // check if child if opaque first so that NPE is thrown // if child is null. if (child.isOpaque() || base.isOpaque()) return child; if (!equalIgnoringCase(base.scheme, child.scheme) || !equal(base.authority, child.authority)) return child; String bp= normalize(base.path); String cp= normalize(child.path); if (!bp.equals(cp)) { if (!bp.endsWith("/")) bp= bp + "/"; if (!cp.startsWith(bp)) return child; } URI v= new URI(); v.path= cp.substring(bp.length()); v.query= child.query; v.fragment= child.fragment; return v; }
private static URI relativize(URI base, URI child) { // check if child if opaque first so that NPE is thrown // if child is null. if (child.isOpaque() || base.isOpaque()) return child; if (!equalIgnoringCase(base.scheme, child.scheme) || !equal(base.authority, child.authority)) return child; String bp = normalize(base.path); String cp = normalize(child.path); if (!bp.equals(cp)) { if (!bp.endsWith("/")) bp = bp + "/"; if (!cp.startsWith(bp)) return child; } URI v = new URI(); v.path = cp.substring(bp.length()); v.query = child.query; v.fragment = child.fragment; return v; }
URI that = (URI)ob; if (this.isOpaque() != that.isOpaque()) return false; if (!equalIgnoringCase(this.scheme, that.scheme)) return false; if (!equal(this.fragment, that.fragment)) return false; if (!equalIgnoringCase(this.host, that.host)) return false; if (this.port != that.port) return false; } else if (this.authority != null) {
URI that = (URI)ob; if (this.isOpaque() != that.isOpaque()) return false; if (!equalIgnoringCase(this.scheme, that.scheme)) return false; if (!equal(this.fragment, that.fragment)) return false; if (!equalIgnoringCase(this.host, that.host)) return false; if (this.port != that.port) return false; } else if (this.authority != null) {
if (this.isOpaque() != that.isOpaque()) return false; if (!equalIgnoringCase(this.scheme, that.scheme)) return false; if (!equal(this.fragment, that.fragment)) if (!equalIgnoringCase(this.host, that.host)) return false; if (this.port != that.port)