private String buildCompositionSubTaskLink(String name) { final String compositionSubTaskId = getSelfId() + "-" + UriUtilsExtended.getValueEncoded(name); return UriUtils.buildUriPath(CompositionSubTaskFactoryService.SELF_LINK, compositionSubTaskId); }
String name = UriUtilsExtended.getValueEncoded(rn.name); String allocName = name + CompositionSubTaskService.ALLOC_SUFFIX; progress.remove(UriUtilsExtended.getValueEncoded(DEFAULT_COMPONENT_NAME));
/** * Returns the provided {@link URI} transformed to be sent to the {@link ReverseProxyService} * instead of accessing directly to it. * * Some transformation examples ({xyz} means Reverse Proxy encoded path): * <pre> * http://abc:80/p1/p2 -> ../rp/{http://abc:80/p1/p2} * http://abc:80/p1/p2?q1=v1 -> ../rp/{http://abc:80/p1/p2?q1=v1} * </pre> * * @param in * {@link URI} going to the {@link ReverseProxyService} * @return {@link ReverseProxyService} {@link URI} */ public static URI getReverseProxyUri(URI in) { if (in == null) { return null; } String encodedUri = getValueEncoded(in.toString()); return UriUtils.buildUri(UriUtils.buildUriPath(ReverseProxyService.SELF_LINK, encodedUri)); }
getValueEncoded(location)); if (originalUri == null) { return newLocation;
@Test public void testReverseProxyEncoding() { String encoded = UriUtilsExtended.getValueEncoded(SAMPLE_URL); assertNotEquals(SAMPLE_URL, encoded); String decoded = UriUtilsExtended.getReverseProxyDecoded(encoded); assertNotEquals(encoded, decoded); assertEquals(SAMPLE_URL, decoded); }
@Test public void testReverseProxyInvalidTransformations() { URI uri = UriUtilsExtended.getReverseProxyUri(null); assertNull(uri); uri = UriUtilsExtended.getReverseProxyTargetUri(null); assertNull(uri); URI opUri = UriUtils.buildUri("http://localhost/rp"); uri = UriUtilsExtended.getReverseProxyTargetUri(opUri); assertNull(uri); opUri = UriUtils.buildUri("http://localhost/rp/f-o-o/bar"); uri = UriUtilsExtended.getReverseProxyTargetUri(opUri); assertNull(uri); opUri = UriUtils.buildUri("http://localhost/rp/" + UriUtilsExtended.getValueEncoded("%0")); try { uri = UriUtilsExtended.getReverseProxyTargetUri(opUri); fail("URI should be invalid!"); } catch (LocalizableValidationException e) { assertTrue(e.getMessage().startsWith("Invalid target URI:")); } }
+ UriUtilsExtended.getValueEncoded(containerDesc.name) + CompositionSubTaskService.ALLOC_SUFFIX; String rsrvSelfLink = UriUtils.buildUriPath(ReservationTaskFactoryService.SELF_LINK,