Class ODataUriFactory
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.client.request.ODataUriFactory
Builds up OData URLs and ensures correct encoding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringencodePath(String path) Encodes the individual path parts of a string.static StringencodePath(String path, UriEncodingStrategy strategy) Encodes the individual path parts of a string.static StringencodePathSegment(String path) Encodes an individual part of a URL path.static StringencodePathSegment(String path, UriEncodingStrategy strategy) Encodes an individual part of a URL path.static StringencodeQuery(String input) Encodes all characters according to the default encoding strategyUriEncodingStrategy.REGULAR.static StringencodeQuery(String input, UriEncodingStrategy strategy) Encodes all characters according to the providedUriEncodingStrategy.static io.vavr.control.Option<String>extractDeltaToken(String url) Get the delta-token from a URL.static io.vavr.control.Option<String>extractSkipToken(String url) Get the skip-token from a URL.
-
Constructor Details
-
ODataUriFactory
public ODataUriFactory()
-
-
Method Details
-
encodePath
Encodes the individual path parts of a string. Forward slashes are treated as path segment separators and thus not be encoded. Encoding is done byUrlEscapers.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 byUrlEscapers.urlPathSegmentEscaper().- Parameters:
path- The unencoded URL path.strategy- The URI encoding strategy.- Returns:
- The percentage encoded URL path.
-
encodePathSegment
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 defaultUrlEscapers.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 passedUriEncodingStrategy.getPathPercentEscaper().- Parameters:
path- The unencoded URL path segment.strategy- The URI encoding strategy.- Returns:
- The percentage encoded URL path segment.
-
encodeQuery
Encodes all characters according to the default encoding strategyUriEncodingStrategy.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 providedUriEncodingStrategy.- Parameters:
input- The query string of the requeststrategy- The URI encoding strategy.- Returns:
- The encoded query
-
extractDeltaToken
Get the delta-token from a URL.- Parameters:
url- The url ornull.- Returns:
- Either
Option.some(String)with the delta-token orOption.empty().
-
extractSkipToken
Get the skip-token from a URL.- Parameters:
url- The url ornull.- Returns:
- Either
Option.some(String)with the skip-token orOption.empty().
-