#398 - Remove unnecessary URI conversion in ControllerLinkBuilderFactory.
ControllerLinkBuilderFactory now forwards the source UriComponents to the ControllerLinkBuilder instead of turning it into a URI and a UriComponentsBuilder in turn. Original pull request: #422.
This commit is contained in:
committed by
Oliver Gierke
parent
dd0f9e8905
commit
7174015746
@@ -49,6 +49,11 @@ public abstract class LinkBuilderSupport<T extends LinkBuilder> implements LinkB
|
||||
this.uriComponents = builder.build();
|
||||
}
|
||||
|
||||
public LinkBuilderSupport(UriComponents uriComponents) {
|
||||
Assert.notNull(uriComponents);
|
||||
this.uriComponents = uriComponents;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.hateoas.LinkBuilder#slash(java.lang.Object)
|
||||
|
||||
@@ -60,6 +60,15 @@ public class ControllerLinkBuilder extends LinkBuilderSupport<ControllerLinkBuil
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ControllerLinkBuilder} using the given {@link UriComponents}.
|
||||
*
|
||||
* @param uriComponents must not be {@literal null}.
|
||||
*/
|
||||
ControllerLinkBuilder(UriComponents uriComponents) {
|
||||
super(uriComponents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link ControllerLinkBuilder} with a base of the mapping annotated to the given controller class.
|
||||
*
|
||||
* @param controller the class to discover the annotation on, must not be {@literal null}.
|
||||
|
||||
@@ -137,7 +137,7 @@ public class ControllerLinkBuilderFactory implements MethodLinkBuilderFactory<Co
|
||||
}
|
||||
|
||||
UriComponents components = applyUriComponentsContributer(builder, invocation).buildAndExpand(values);
|
||||
return new ControllerLinkBuilder(UriComponentsBuilder.fromUriString(components.toUriString()));
|
||||
return new ControllerLinkBuilder(components);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user