public abstract class ServletContextPropertyUtils
extends java.lang.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 java.lang.String |
resolvePlaceholders(java.lang.String text,
ServletContext servletContext)
Resolve ${...} placeholders in the given text, replacing them with corresponding
servlet context init parameter or system property values.
|
static java.lang.String |
resolvePlaceholders(java.lang.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 java.lang.String resolvePlaceholders(java.lang.String text, ServletContext servletContext)
text
- the String to resolveservletContext
- the servletContext to use for lookups.java.lang.IllegalArgumentException
- if there is an unresolvable placeholderSystemPropertyUtils.PLACEHOLDER_PREFIX
,
SystemPropertyUtils.PLACEHOLDER_SUFFIX
,
SystemPropertyUtils.resolvePlaceholders(String, boolean)
public static java.lang.String resolvePlaceholders(java.lang.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 ignoredjava.lang.IllegalArgumentException
- if there is an unresolvable placeholder and the flag is falseSystemPropertyUtils.PLACEHOLDER_PREFIX
,
SystemPropertyUtils.PLACEHOLDER_SUFFIX
,
SystemPropertyUtils.resolvePlaceholders(String, boolean)