Lines Matching defs:relative

52  * URIs are either {@link #isAbsolute() absolute or relative}.
62 * have the absolute URI that a relative URI is relative to, you can use {@link
64 * {@link #relativize} to compute the relative URI from one URI to another.
67 * URI relative = new URI("robots.txt");
71 * System.out.println(absolute.resolve(relative));
1105 * Makes the given URI {@code relative} to a relative URI against the URI
1108 * @param relative
1110 * @return the relative URI.
1112 public URI relativize(URI relative) {
1113 if (relative.opaque || opaque) {
1114 return relative;
1117 if (scheme == null ? relative.scheme != null : !scheme
1118 .equals(relative.scheme)) {
1119 return relative;
1122 if (authority == null ? relative.authority != null : !authority
1123 .equals(relative.authority)) {
1124 return relative;
1129 String relativePath = normalize(relative.path, false);
1133 * path is a parent path (begins with) the relative URI's path
1140 * if the relative URI's path doesn't start with this URI's path,
1141 * then just return the relative URI; the URIs have nothing in
1145 return relative;
1150 result.fragment = relative.fragment;
1151 result.query = relative.query;
1152 // the result URI is the remainder of the relative URI's path
1159 * Resolves the given URI {@code relative} against the URI represented by
1162 * @param relative
1166 public URI resolve(URI relative) {
1167 if (relative.absolute || opaque) {
1168 return relative;
1171 if (relative.authority != null) {
1172 // If the relative URI has an authority, the result is the relative
1174 URI result = relative.duplicate();
1180 if (relative.path.isEmpty() && relative.scheme == null && relative.query == null) {
1181 // if the relative URI only consists of at most a fragment,
1183 result.fragment = relative.fragment;
1188 result.fragment = relative.fragment;
1189 result.query = relative.query;
1191 if (relative.path.startsWith("/")) {
1192 // The relative URI has an absolute path; use it.
1193 resolvedPath = relative.path;
1194 } else if (relative.path.isEmpty()) {
1195 // The relative URI has no path; use the base path.
1198 // The relative URI has a relative path; combine the paths.
1200 resolvedPath = path.substring(0, endIndex) + relative.path;
1229 * Creates a new URI instance by parsing the given string {@code relative}
1233 * @param relative
1238 public URI resolve(String relative) {
1239 return resolve(create(relative));