Interface ServiceIdExtractor

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ServiceIdExtractor
    Extract the serviceId from a given URL. This interface was introduced to address one shortcoming of the HalClient: it was assuming that all links in a HalResource are pointing to the same service. Therefore all CaravanHttpRequests were created with the serviceId that was initially passed when creating the HalClient, not the serviceId where the URL is actually pointing to. This interface now allows to specify a rule that can extract the serviceId from a given path.
    • Method Detail

      • getServiceId

        String getServiceId​(String href)
        Parameters:
        href - an absolute path from a link that is followed by the HalCient
        Returns:
        the serviceId that should be used when creating a CaravanHttpRequest for that link