public abstract class ServletContextPropertyUtils extends Object
A text may contain ${...}
placeholders, to be resolved as servlet context
init parameters or system properties: e.g. ${user.dir}
. Default values can
be supplied using the ":" separator between key and value.
SystemPropertyUtils
,
ServletContext.getInitParameter(String)
Constructor and Description |
---|
ServletContextPropertyUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
resolvePlaceholders(String text,
ServletContext servletContext)
Resolve ${...} placeholders in the given text, replacing them with corresponding
servlet context init parameter or system property values.
|
static String |
resolvePlaceholders(String text,
ServletContext servletContext,
boolean ignoreUnresolvablePlaceholders)
Resolve ${...} placeholders in the given text, replacing them with corresponding
servlet context init parameter or system property values.
|
public static String resolvePlaceholders(String text, ServletContext servletContext)
text
- the String to resolveservletContext
- the servletContext to use for lookups.IllegalArgumentException
- if there is an unresolvable placeholderSystemPropertyUtils.PLACEHOLDER_PREFIX
,
SystemPropertyUtils.PLACEHOLDER_SUFFIX
,
SystemPropertyUtils.resolvePlaceholders(String, boolean)
public static String resolvePlaceholders(String text, ServletContext servletContext, boolean ignoreUnresolvablePlaceholders)
text
- the String to resolveservletContext
- the servletContext to use for lookups.ignoreUnresolvablePlaceholders
- flag to determine is unresolved placeholders are ignoredIllegalArgumentException
- if there is an unresolvable placeholder and the flag is false
SystemPropertyUtils.PLACEHOLDER_PREFIX
,
SystemPropertyUtils.PLACEHOLDER_SUFFIX
,
SystemPropertyUtils.resolvePlaceholders(String, boolean)