Class ODataUriFactory

java.lang.Object
com.sap.cloud.sdk.datamodel.odata.client.request.ODataUriFactory

public class ODataUriFactory extends Object
Builds up OData URLs and ensures correct encoding.
  • Constructor Details

    • ODataUriFactory

      public ODataUriFactory()
  • Method Details

    • encodePath

      @Nonnull public static String encodePath(@Nonnull String path)
      Encodes the individual path parts of a string. Forward slashes are treated as path segment separators and thus not be encoded. Encoding is done by UrlEscapers.urlPathSegmentEscaper().
      Parameters:
      path - The unencoded URL path.
      Returns:
      The percentage encoded URL path.
    • encodePath

      @Nonnull public static String encodePath(@Nonnull String path, @Nonnull UriEncodingStrategy strategy)
      Encodes the individual path parts of a string. Forward slashes are treated as path segment separators and thus not be encoded. Encoding is done by UrlEscapers.urlPathSegmentEscaper().
      Parameters:
      path - The unencoded URL path.
      strategy - The URI encoding strategy.
      Returns:
      The percentage encoded URL path.
    • encodePathSegment

      @Nonnull public static String encodePathSegment(@Nonnull String path)
      Encodes an individual part of a URL path. Any forward slashes will not be treated as path segment separators but instead be encoded. Encoding is done by the default UrlEscapers.urlPathSegmentEscaper().
      Parameters:
      path - The unencoded URL path segment.
      Returns:
      The percentage encoded URL path segment.
    • encodePathSegment

      @Nonnull public static String encodePathSegment(@Nonnull String path, @Nonnull UriEncodingStrategy strategy)
      Encodes an individual part of a URL path. Any forward slashes will not be treated as path segment separators but instead be encoded. Encoding is done according to the passed UriEncodingStrategy.getPathPercentEscaper().
      Parameters:
      path - The unencoded URL path segment.
      strategy - The URI encoding strategy.
      Returns:
      The percentage encoded URL path segment.
    • encodeQuery

      @Nonnull public static String encodeQuery(@Nonnull String input)
      Encodes all characters according to the default encoding strategy UriEncodingStrategy.REGULAR.
      Parameters:
      input - The query string of the request
      Returns:
      The encoded query
    • encodeQuery

      @Nonnull public static String encodeQuery(@Nonnull String input, @Nonnull UriEncodingStrategy strategy)
      Encodes all characters according to the provided UriEncodingStrategy.
      Parameters:
      input - The query string of the request
      strategy - The URI encoding strategy.
      Returns:
      The encoded query
    • extractDeltaToken

      @Nonnull public static io.vavr.control.Option<String> extractDeltaToken(@Nullable String url)
      Get the delta-token from a URL.
      Parameters:
      url - The url or null.
      Returns:
      Either Option.some(String) with the delta-token or Option.empty().
    • extractSkipToken

      @Nonnull public static io.vavr.control.Option<String> extractSkipToken(@Nullable String url)
      Get the skip-token from a URL.
      Parameters:
      url - The url or null.
      Returns:
      Either Option.some(String) with the skip-token or Option.empty().