Class UriPathMerger

java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.UriPathMerger

public class UriPathMerger extends Object
Utility class offering the ability to merge two URIs.
  • Constructor Details

    • UriPathMerger

      public UriPathMerger()
  • Method Details

    • merge

      @Nonnull public URI merge(@Nonnull URI primaryUri, @Nullable URI secondaryUri) throws DestinationPathsNotMergeableException
      Merges two URI addresses, checking that both URIs have the same scheme, host and port. If secondary URI is absolute (i.e. it has schema and host definition) then path of primary URI is omitted. Otherwise, the paths are appended. Query parameters are combined. Fragment of secondary URI is preferred.
      Parameters:
      primaryUri - The primary URI, usually pointing to the destination.
      secondaryUri - The secondary URI, usually identifying the request at runtime.
      Returns:
      The merged URI, representing the given request executed on the given destination.
      Throws:
      DestinationPathsNotMergeableException - If either of the request paths of the the given URIs are null or the URIs differ in the used schema, host, or port.