public class ServiceUriBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
ERP_ENDPOINT_CLOUD |
protected static String |
ERP_ENDPOINT_ON_PREMISE |
Constructor and Description |
---|
ServiceUriBuilder() |
Modifier and Type | Method and Description |
---|---|
protected static String |
appendSlashIfMissing(String path)
Adds a slash ('/') as a suffix if it is not yet present.
|
URI |
build(URI baseUri,
String relativePath)
Builds a ERP service URI for a given relative path.
|
protected static String |
encloseSlashesIfMissing(String path)
Encloses the given String with a slash ('/') if they are not yet present.
|
protected static String |
prependSlashIfMissing(String path)
Adds a slash ('/') as a prefix if it is not yet present.
|
static void |
registerTestSystem(URI uri)
Adds a test system path.
|
protected String |
removeErpEndpointPaths(URI baseUri)
Removes all known and registered endpoints from the path of the given URI.
|
protected static final String ERP_ENDPOINT_CLOUD
protected static final String ERP_ENDPOINT_ON_PREMISE
public static void registerTestSystem(URI uri)
uri
- Adds the path contained in the URI to the collection of endpoints to be removed.protected static String prependSlashIfMissing(String path)
path
- The String to prefix with a slash.protected static String appendSlashIfMissing(String path)
path
- The String to suffix with a slash.protected static String encloseSlashesIfMissing(String path)
path
- The String to pre- and suffix with a slash.protected String removeErpEndpointPaths(URI baseUri)
See registerTestSystem(URI)
, ERP_ENDPOINT_CLOUD
, and ERP_ENDPOINT_ON_PREMISE
.
baseUri
- The URI to take the path to be adjusted from.public URI build(@Nonnull URI baseUri, @Nonnull String relativePath)
Therefore the path contained in baseUri
is stripped of all known and registered endpoints (see
registerTestSystem(URI)
) and gets the relativePath
added.
baseUri
- The URI to replace/adjust the path property.relativePath
- The relative path to be used.baseUri
, modified by adjusting the contained path with the
given relativePath
.IllegalArgumentException
- If the new URI object could not be created, most likely due to a wrongly formatted relativePath.Copyright © 2019 SAP SE. All rights reserved.