public class ConfigurationUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BASE_URL
Base URL.
|
static com.sdl.delivery.configuration.ConfigurationPath |
BASE_URLS_REL_PATH
Base URLS Rel Path.
|
static String |
CONFIG_VALUE_CONTEXT_PATH
Config Value Context Path.
|
static String |
CONFIG_VALUE_HOST
Config Value Host.
|
static int |
CONFIG_VALUE_HTTP_PORT_DEFAULT
Config Value HTTP Port Default.
|
static int |
CONFIG_VALUE_HTTPS_PORT_DEFAULT
Config Value HTTPS Port Default.
|
static String |
CONFIG_VALUE_NAMESPACE_ID
Config Value NamespaceId.
|
static String |
CONFIG_VALUE_PATH
Config Value Path.
|
static String |
CONFIG_VALUE_PORT
Config Value Port.
|
static int |
CONFIG_VALUE_PORT_NOT_SET
Config Value Port not set.
|
static String |
CONFIG_VALUE_PROTOCOL
Config Value Protocol.
|
static String |
CONFIG_VALUE_PROTOCOL_FILE
Config Value Protocol File.
|
static String |
CONFIG_VALUE_PROTOCOL_HTTP
Config Value Protocol HTTP.
|
static String |
CONFIG_VALUE_PROTOCOL_HTTPS
Config Value Protocol HTTPS.
|
static String |
CONFIG_VALUE_PUB_ID
Config Value Pub ID.
|
static String |
CONFIG_VALUE_ROOT_PATH
Config Value Root Path.
|
static com.sdl.delivery.configuration.ConfigurationPath |
EXTENSION_PROPERTIES
Extension Properties.
|
static String |
KEY
Key.
|
static com.sdl.delivery.configuration.ConfigurationPath |
PUBLICATION_REL_PATH
Publication Rel Path.
|
static String |
RESOURCE_NAME
The resource name to find the configuration for 'Dynamic Content' and 'Linking'.
|
static String |
VALUE
Value.
|
static com.sdl.delivery.configuration.ConfigurationPath |
WEB_APP_PATH
Web App Path.
|
Constructor and Description |
---|
ConfigurationUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
createUrlFrom(com.sdl.delivery.configuration.Configuration baseUrlConfig,
String contextPath)
Create a String URL for the given Base URL configuration and context path.
|
static int |
getBaseUrlPort(com.sdl.delivery.configuration.Configuration baseUrlConfig,
String protocol)
Get the port from the given Base URL configuration, taking into account the given protocol.
|
static String |
getBaseUrlProtocol(com.sdl.delivery.configuration.Configuration baseUrlConfig)
Get the protocol from the given Base URL configuration.
|
static List<com.sdl.delivery.configuration.Configuration> |
getConfigurations(com.sdl.delivery.configuration.Configuration configuration,
com.sdl.delivery.configuration.ConfigurationPath path)
This is a small convenience method that in case of an optional path returns an empty list instead of throwing
an exception.
|
static List<com.sdl.delivery.configuration.Configuration> |
getConfigurations(com.sdl.delivery.configuration.Configuration configuration,
String path)
Check
getConfigurations(Configuration, ConfigurationPath) for more information. |
static String |
getRelativePath(String contextPath,
String publicationPath)
Get the relative path for the given 'context' and 'publication' path(s).
|
static Map<String,Integer> |
getUrlToPublicationIdMappings(com.sdl.delivery.configuration.Configuration configuration)
Extract the URL mappings, by retrieving this information from the publication configuration(s).
|
static boolean |
getValueAsBoolean(com.sdl.delivery.configuration.Configuration configuration,
String property,
boolean defaultValue) |
static String |
getValueAsString(com.sdl.delivery.configuration.Configuration configuration,
String property,
String defaultValue) |
static boolean |
isPortSet(int port)
Check if the given port is set.
|
static String |
nullToEmpty(String string)
Returns the given string if it is non-null; the empty string otherwise.
|
public static final String BASE_URL
public static final com.sdl.delivery.configuration.ConfigurationPath WEB_APP_PATH
public static final com.sdl.delivery.configuration.ConfigurationPath PUBLICATION_REL_PATH
public static final com.sdl.delivery.configuration.ConfigurationPath BASE_URLS_REL_PATH
public static final com.sdl.delivery.configuration.ConfigurationPath EXTENSION_PROPERTIES
public static final String RESOURCE_NAME
public static final String CONFIG_VALUE_PUB_ID
public static final String CONFIG_VALUE_NAMESPACE_ID
public static final String CONFIG_VALUE_PROTOCOL
public static final String CONFIG_VALUE_HOST
public static final String CONFIG_VALUE_PORT
public static final String CONFIG_VALUE_CONTEXT_PATH
public static final String CONFIG_VALUE_PATH
public static final String CONFIG_VALUE_PROTOCOL_HTTP
public static final String CONFIG_VALUE_PROTOCOL_HTTPS
public static final String CONFIG_VALUE_PROTOCOL_FILE
public static final String CONFIG_VALUE_ROOT_PATH
public static final int CONFIG_VALUE_PORT_NOT_SET
public static final int CONFIG_VALUE_HTTP_PORT_DEFAULT
public static final int CONFIG_VALUE_HTTPS_PORT_DEFAULT
public static final String KEY
public static final String VALUE
public static Map<String,Integer> getUrlToPublicationIdMappings(com.sdl.delivery.configuration.Configuration configuration)
configuration
- The main configuration including the publication configuration(s). It can not be null
.public static String getBaseUrlProtocol(com.sdl.delivery.configuration.Configuration baseUrlConfig) throws com.sdl.delivery.configuration.ConfigurationException
baseUrlConfig
- The given Base URL configuration. It can not be null
.com.sdl.delivery.configuration.ConfigurationException
public static int getBaseUrlPort(com.sdl.delivery.configuration.Configuration baseUrlConfig, String protocol) throws com.sdl.delivery.configuration.ConfigurationException
baseUrlConfig
- The given Base URL configuration. It can not be null
.protocol
- The given protocol. It can not be null
.com.sdl.delivery.configuration.ConfigurationException
public static String getRelativePath(String contextPath, String publicationPath)
contextPath
- The given 'context' pathpublicationPath
- The given 'publication' path.public static String createUrlFrom(com.sdl.delivery.configuration.Configuration baseUrlConfig, String contextPath) throws com.sdl.delivery.configuration.ConfigurationException
baseUrlConfig
- The given Base URL configuration. It can not be null
.contextPath
- The given context path. If null
is used, an empty path will be used instead.com.sdl.delivery.configuration.ConfigurationException
public static String getValueAsString(com.sdl.delivery.configuration.Configuration configuration, String property, String defaultValue) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.ConfigurationException
public static boolean getValueAsBoolean(com.sdl.delivery.configuration.Configuration configuration, String property, boolean defaultValue) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.ConfigurationException
public static List<com.sdl.delivery.configuration.Configuration> getConfigurations(com.sdl.delivery.configuration.Configuration configuration, String path)
getConfigurations(Configuration, ConfigurationPath)
for more information.public static String nullToEmpty(String string)
string
- the string to test and possibly returnstring
itself if it is non-null; ""
if it is nullpublic static List<com.sdl.delivery.configuration.Configuration> getConfigurations(com.sdl.delivery.configuration.Configuration configuration, com.sdl.delivery.configuration.ConfigurationPath path)
configuration
- The configuration to look for a child path inpath
- The path to look uppublic static boolean isPortSet(int port)
port
- The given port.true
when the port is set, false
otherwise.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries