DATACMNS-419 - PagedResourceAssemblerArgumentResolver now works with templated URIs.

We now handle an IllegalArgumentException being thrown in case we deal with a templated request mapping. We simply skip the attempt to eagerly resolve the base URI for the request and rely on the assembler being capable of resolving it itself or the user effectively providing a Link instances to one of the toResource(…) overloads.
This commit is contained in:
Oliver Gierke
2014-01-16 14:34:14 +01:00
parent 92a22182f1
commit 72a8d072a3
2 changed files with 29 additions and 3 deletions

View File

@@ -128,6 +128,18 @@ public class PagedResourcesAssemblerArgumentResolverUnitTests {
assertRejectsAmbiguity("noMatchingQualifiers");
}
/**
* @see DATACMNS-419
*/
@Test
public void doesNotFailForTemplatedMethodMapping() throws Exception {
Method method = Controller.class.getMethod("methodWithPathVariable", PagedResourcesAssembler.class);
Object result = resolver.resolveArgument(new MethodParameter(method, 0), null, null, null);
assertThat(result, is(notNullValue()));
}
private void assertSelectsParameter(Method method, int expectedIndex) throws Exception {
MethodParameter parameter = new MethodParameter(method, 0);