@Override public URI apply(String path) throws HttpException { String requestedResource = new StringBuilder().append("/rest/namespace/").append(path).toString(); String expires = timeStampProvider.get().toString(); String signature = signString(createStringToSign(requestedResource, expires)); return uriBuilder(provider.get()) .replaceQuery(ImmutableMap.of("uid", creds.get().identity, "expires", expires, "signature", signature)) .appendPath(requestedResource).build(); }
@Override public URI apply(String path) throws HttpException { String requestedResource = new StringBuilder().append("/rest/namespace/").append(path).toString(); String expires = timeStampProvider.get().toString(); String signature = signString(createStringToSign(requestedResource, expires)); return uriBuilder(provider.get()) .replaceQuery(ImmutableMap.of("uid", creds.get().identity, "expires", expires, "signature", signature)) .appendPath(requestedResource).build(); }
private Multimap<String, Object> addPathAndGetTokens(Invocation invocation, UriBuilder uriBuilder) { if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Path.class).value()); if (invocation.getInvokable().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getAnnotation(Path.class).value()); return getPathParamKeyValues(invocation); }
private Multimap<String, Object> addPathAndGetTokens(Invocation invocation, UriBuilder uriBuilder, boolean encodeFullPath) { if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Path.class).value()); if (invocation.getInvokable().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getAnnotation(Path.class).value()); return getPathParamKeyValues(invocation, encodeFullPath); }
public ObjectInfo apply(ObjectInfoImpl from) { return from.toBuilder().container(container) .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(from.getName()).build()) .build(); } }));
@Override public URI apply(String input) { return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/regions/").appendPath(input).build(); } };
@Override public URI apply(String input) { SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(input); return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/zones/").appendPath(slashEncodedIds.getFirstId()) .appendPath("/machineTypes/").appendPath(slashEncodedIds.getSecondId()).build(); } };
@Test public void testNoDoubleSlashInPath() { assertEquals(uriBuilder("https://vcloud/api/").appendPath("/").build().toASCIIString(), "https://vcloud/api/"); }
@Override public URI apply(String input) { return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/regions/").appendPath(input).build(); } };
@Override public URI apply(String input) { return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/zones/").appendPath(input).build(); } };
public ObjectInfo apply(ObjectInfoImpl from) { return from.toBuilder().container(container) .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(from.getName()).build()) .build(); } }));
public ObjectInfo apply(ObjectInfoImpl from) { return from.toBuilder().container(container) .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(from.getName()).build()) .build(); } }));
private Multimap<String, Object> addPathAndGetTokens(Invocation invocation, UriBuilder uriBuilder, boolean encodeFullPath) { if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Path.class).value()); if (invocation.getInvokable().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getAnnotation(Path.class).value()); return getPathParamKeyValues(invocation, encodeFullPath); }
private Multimap<String, Object> addPathAndGetTokens(Invocation invocation, UriBuilder uriBuilder) { if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Path.class).value()); if (invocation.getInvokable().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getAnnotation(Path.class).value()); return getPathParamKeyValues(invocation); }
private Multimap<String, Object> addPathAndGetTokens(Invocation invocation, UriBuilder uriBuilder) { if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getOwnerType().getRawType().getAnnotation(Path.class).value()); if (invocation.getInvokable().isAnnotationPresent(Path.class)) uriBuilder.appendPath(invocation.getInvokable().getAnnotation(Path.class).value()); return getPathParamKeyValues(invocation); }
@Test public void testWhenMatrixOnPath() { assertEquals( uriBuilder("https://api.rimuhosting.com/r").appendPath("orders;include_inactive=N").build(templateParams) .toASCIIString(), "https://api.rimuhosting.com/r/orders;include_inactive=N"); }
@Test public void testWhenUrnInPath() { assertEquals(uriBuilder("https://vcloud/api").appendPath("urn::acme:foo").build(templateParams).toASCIIString(), "https://vcloud/api/urn::acme:foo"); }
public ObjectInfo apply(ObjectInfoImpl from) { return from.toBuilder().container(container) .uri(uriBuilder(request.getEndpoint()).clearQuery().appendPath(from.getName()).build()) .build(); } }));
@Override public URI apply(String input) { return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/global/networks/").appendPath(input).build(); } };
@Override public URI apply(String input) { return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get()) .appendPath("/global/networks/").appendPath(input).build(); } };