@Test void resolve() throws MalformedURLException, CreateResourceReferenceException, UnsupportedResourceReferenceException { ExtendedURL extendedURL = new ExtendedURL( new URL("http: ResourceType type = new ResourceType("test"); ParentResourceReference reference = this.resolver.resolve(extendedURL, type, null); assertSame(type, reference.getType()); assertEquals("child", reference.getChild()); assertEquals("child/1/2/3", reference.getRootPath()); assertEquals(Arrays.asList("1", "2", "3"), reference.getPathSegments()); assertEquals(2, reference.getParameters().size()); assertEquals(Arrays.asList("value11", "value12"), reference.getParameters().get("key1")); assertEquals(Arrays.asList("value2"), reference.getParameters().get("key2")); }
@Override public ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType, Map<String, Object> parameters) throws CreateResourceReferenceException, UnsupportedResourceReferenceException { String path = ""; String child = ""; List<String> pathSegments = extendedURL.getSegments(); if (!pathSegments.isEmpty()) { StringBuilder pathBuilder = new StringBuilder(); try { for (String pathSegment : extendedURL.getSegments()) { if (pathBuilder.length() > 0) { pathBuilder.append('/'); } pathBuilder.append(URLEncoder.encode(pathSegment, "UTF8")); } } catch (UnsupportedEncodingException e) { } path = pathBuilder.toString(); child = pathSegments.get(0); if (pathSegments.size() > 1) { pathSegments = pathSegments.subList(1, pathSegments.size()); } else { pathSegments = Collections.emptyList(); } } ParentResourceReference reference = new ParentResourceReference(resourceType, path, child, pathSegments); copyParameters(extendedURL, reference); return reference; }
AbstractParentResourceReferenceResolver extends AbstractResourceReferenceResolver { @Override public ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType, Map<String, Object> parameters) throws CreateResourceReferenceException, UnsupportedResourceReferenceException { String path = ""; String child = ""; List<String> pathSegments = extendedURL.getSegments(); if (!pathSegments.isEmpty()) { StringBuilder pathBuilder = new StringBuilder(); try { for (String pathSegment : extendedURL.getSegments()) { if (pathBuilder.length() > 0) { pathBuilder.append('/'); } pathBuilder.append(URLEncoder.encode(pathSegment, "UTF8")); } } catch (UnsupportedEncodingException e) { } path = pathBuilder.toString(); child = pathSegments.get(0); if (pathSegments.size() > 1) { pathSegments = pathSegments.subList(1, pathSegments.size()); } else { pathSegments = Collections.emptyList(); } } ParentResourceReference reference = new ParentResourceReference(resourceType, path, child, pathSegments); copyParameters(extendedURL, reference); return reference; } }
AbstractParentResourceReferenceResolver extends AbstractResourceReferenceResolver { @Override public ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType, Map<String, Object> parameters) throws CreateResourceReferenceException, UnsupportedResourceReferenceException { String path = ""; String child = ""; List<String> pathSegments = extendedURL.getSegments(); if (!pathSegments.isEmpty()) { StringBuilder pathBuilder = new StringBuilder(); try { for (String pathSegment : extendedURL.getSegments()) { if (pathBuilder.length() > 0) { pathBuilder.append('/'); } pathBuilder.append(URLEncoder.encode(pathSegment, "UTF8")); } } catch (UnsupportedEncodingException e) { } path = pathBuilder.toString(); child = pathSegments.get(0); if (pathSegments.size() > 1) { pathSegments = pathSegments.subList(1, pathSegments.size()); } else { pathSegments = Collections.emptyList(); } } ParentResourceReference reference = new ParentResourceReference(resourceType, path, child, pathSegments); copyParameters(extendedURL, reference); return reference; }  }
AbstractParentResourceReferenceResolver extends AbstractResourceReferenceResolver { @Override public ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType, Map<String, Object> parameters) throws CreateResourceReferenceException, UnsupportedResourceReferenceException { String path = ""; String child = ""; List<String> pathSegments = extendedURL.getSegments(); if (!pathSegments.isEmpty()) { StringBuilder pathBuilder = new StringBuilder(); try { for (String pathSegment : extendedURL.getSegments()) { if (pathBuilder.length() > 0) { pathBuilder.append('/'); } pathBuilder.append(URLEncoder.encode(pathSegment, "UTF8")); } } catch (UnsupportedEncodingException e) { } path = pathBuilder.toString(); child = pathSegments.get(0); if (pathSegments.size() > 1) { pathSegments = pathSegments.subList(1, pathSegments.size()); } else { pathSegments = Collections.emptyList(); } } ParentResourceReference reference = new ParentResourceReference(resourceType, path, child, pathSegments); copyParameters(extendedURL, reference); return reference; }  @Override ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType,
        Map<String, Object> parameters); }
AbstractParentResourceReferenceResolver extends AbstractResourceReferenceResolver { @Override public ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType, Map<String, Object> parameters) throws CreateResourceReferenceException, UnsupportedResourceReferenceException { String path = ""; String child = ""; List<String> pathSegments = extendedURL.getSegments(); if (!pathSegments.isEmpty()) { StringBuilder pathBuilder = new StringBuilder(); try { for (String pathSegment : extendedURL.getSegments()) { if (pathBuilder.length() > 0) { pathBuilder.append('/'); } pathBuilder.append(URLEncoder.encode(pathSegment, "UTF8")); } } catch (UnsupportedEncodingException e) { } path = pathBuilder.toString(); child = pathSegments.get(0); if (pathSegments.size() > 1) { pathSegments = pathSegments.subList(1, pathSegments.size()); } else { pathSegments = Collections.emptyList(); } } ParentResourceReference reference = new ParentResourceReference(resourceType, path, child, pathSegments); copyParameters(extendedURL, reference); return reference; }  @Override ParentResourceReference resolve(ExtendedURL extendedURL, ResourceType resourceType,
        Map<String, Object> parameters);  }