/** * @param base base * @param paths paths * @return concatenated URI * @throws URISyntaxException if the resulting URI is invalid * @deprecated use {@link Uris#concatenate(URI, String...)} instead */ public static URI concatenate(final URI base, final String... paths) throws URISyntaxException { return new URI(concatenate(base.toASCIIString(), paths)); }
public static URI concatenate(final URI base, final URI... paths) { try { final String[] pathStrings = Iterables.toArray( Lists.transform(Lists.newArrayList(paths), new Function<URI, String>() { public String apply(@Nullable URI from) { return from.toASCIIString(); } }), String.class); return concatenate(base, pathStrings); } catch (URISyntaxException e) { throw new RuntimeException("Failed to concatenate URIs", e); } }
public static URI concatenate(final URI base, final URI... paths) { try { final String[] pathStrings = Iterables.toArray( Lists.transform(Lists.newArrayList(paths), new Function<URI, String>() { public String apply(@Nullable URI from) { return from.toASCIIString(); } }), String.class); return concatenate(base, pathStrings); } catch (URISyntaxException e) { throw new RuntimeException("Failed to concatenate URIs", e); } }
/** * ONLY to be used if the caller is <strong>certain</strong> that the base and path will form a valid URI when concatenated. */ public static URI uncheckedConcatenateAndToUri(final String base, final String... paths) { return uncheckedToUri(concatenate(base, paths)); }
/** * ONLY to be used if the caller is <strong>certain</strong> that the base and path will form a valid URI when concatenated. */ public static URI uncheckedConcatenateAndToUri(final String base, final String... paths) { return uncheckedToUri(concatenate(base, paths)); }
/** * ONLY to be used if the caller is <strong>certain</strong> that the base and path will form a valid URI when concatenated. */ public static URI uncheckedConcatenate(final URI base, final String... paths) { try { return concatenate(base, paths); } catch (URISyntaxException e) { throw new RuntimeException(String.format("Failed to concatenate %s to form URI (%s)", base, e.getReason()), e); } }
/** * ONLY to be used if the caller is <strong>certain</strong> that the base and path will form a valid URI when * concatenated. * * @param base base * @param paths paths * @return concatenated URI * @deprecated use {@link Uris#uncheckedConcatenate(URI, String...)} instead */ public static URI uncheckedConcatenate(final URI base, final String... paths) { try { return concatenate(base, paths); } catch (URISyntaxException e) { throw new RuntimeException(String.format("Failed to concatenate %s to form URI (%s)", base, e.getReason()), e); } }
public static URI getBaseRestUri(final URI baseUri) { try { return concatenate(baseUri, "/rest/applinks/1.0");//todo hack - how should we determine this } catch (URISyntaxException e) { //URI is valid - this should never be thrown throw new RuntimeException(String.format("Failed to add REST base path to baseUri: %s", baseUri.toASCIIString()), e); } }