JerseyResourceLinkGenerator extends ResourceLinkGenerator { @Override protected String resourcePathFor(final Method method) { if (isCandidateForAnalysis(method)) { final UriBuilder uriBuilder = new UriBuilderImpl() .uri(applicationBaseUri) .path(method.getDeclaringClass()); if (method.getAnnotation(Path.class) != null) { uriBuilder.path(method); } try { return URLDecoder.decode(uriBuilder.build().toString(), "UTF-8") + queryTemplateFrom(method); } catch (UnsupportedEncodingException e) { } } return null; } JerseyResourceLinkGenerator(final URI applicationBaseUri,
                                       final URI relationTypeBaseUri,
                                       final URI varTypeBaseUri,
                                       final String docRootDir);   }
@Test public void testPathsWithLeadingAndTrailingSlashes() throws Exception { final ResourceLinkGenerator generator = new JerseyResourceLinkGenerator( create("http: create("http: null, null ); final String resource = generator.resourcePathFor( ResourceWithResourceAndLinkRelationType.class.getMethod("bar") ); assertEquals("http: }