Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,23 @@ public LocalHostUriTemplateHandler(Environment environment) {
* @since 1.4.1
*/
public LocalHostUriTemplateHandler(Environment environment, String scheme) {
super(new DefaultUriBuilderFactory());
this(environment, scheme, new DefaultUriBuilderFactory());
}

/**
* Create a new {@code LocalHostUriTemplateHandler} that will generate URIs with the
* given {@code scheme}, use the given {@code environment} to determine the
* context-path and port and delegate to the given template handler.
* @param environment the environment used to determine the port
* @param scheme the scheme of the root uri
* @param delegateHandler the delegate handler
* @since 2.0.X
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since tag uses actual version. That would be 2.0.3.

*/
public LocalHostUriTemplateHandler(Environment environment, String scheme, UriTemplateHandler delegateHandler) {
super(delegateHandler);
Assert.notNull(environment, "Environment must not be null");
Assert.notNull(scheme, "Scheme must not be null");
Assert.notNull(delegateHandler, "DelegateHandler must not be null");
this.environment = environment;
this.scheme = scheme;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public class RootUriTemplateHandler implements UriTemplateHandler {

private final String rootUri;

private final UriTemplateHandler handler;
private final UriTemplateHandler delegateHandler;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rename sounds unnecessary for the task at hand. Can you please revert?


protected RootUriTemplateHandler(UriTemplateHandler handler) {
protected RootUriTemplateHandler(UriTemplateHandler delegateHandler) {
this.rootUri = null;
this.handler = handler;
this.delegateHandler = delegateHandler;
}

/**
Expand All @@ -53,23 +53,23 @@ public RootUriTemplateHandler(String rootUri) {
/**
* Create a new {@link RootUriTemplateHandler} instance.
* @param rootUri the root URI to be used to prefix relative URLs
* @param handler the delegate handler
* @param delegateHandler the delegate handler
*/
public RootUriTemplateHandler(String rootUri, UriTemplateHandler handler) {
public RootUriTemplateHandler(String rootUri, UriTemplateHandler delegateHandler) {
Assert.notNull(rootUri, "RootUri must not be null");
Assert.notNull(handler, "Handler must not be null");
Assert.notNull(delegateHandler, "DelegateHandler must not be null");
this.rootUri = rootUri;
this.handler = handler;
this.delegateHandler = delegateHandler;
}

@Override
public URI expand(String uriTemplate, Map<String, ?> uriVariables) {
return this.handler.expand(apply(uriTemplate), uriVariables);
return this.delegateHandler.expand(apply(uriTemplate), uriVariables);
}

@Override
public URI expand(String uriTemplate, Object... uriVariables) {
return this.handler.expand(apply(uriTemplate), uriVariables);
return this.delegateHandler.expand(apply(uriTemplate), uriVariables);
}

private String apply(String uriTemplate) {
Expand Down