package ru.nbch.credit_tracker.config.rest;

import org.springframework.web.util.DefaultUriBuilderFactory;

import java.net.URI;
import java.util.Map;

public class RootUriTemplateHandler extends DefaultUriBuilderFactory {
    private final String rootUri;

    public RootUriTemplateHandler(String rootUri) {
        super(rootUri);
        this.rootUri = rootUri;
    }

    @Override
    public URI expand(String uriTemplate, Map<String, ?> uriVariables) {
        return super.expand(rootUri + uriTemplate, uriVariables);
    }

    @Override
    public URI expand(String uriTemplate, Object... uriVariables) {
        return super.expand(rootUri + uriTemplate, uriVariables);
    }
}