Package org.springframework.web.util
Class ServletContextPropertyUtils
java.lang.Object
org.springframework.web.util.ServletContextPropertyUtils
Helper class for resolving placeholders in texts. Usually applied to file paths.
 
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.
- Since:
- 3.2.2
- Author:
- Juergen Hoeller, Marten Deinum
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringresolvePlaceholders(String text, ServletContext servletContext) Resolve ${...} placeholders in the given text, replacing them with corresponding servlet context init parameter or system property values.static StringresolvePlaceholders(String text, ServletContext servletContext, boolean ignoreUnresolvablePlaceholders) Resolve ${...} placeholders in the given text, replacing them with corresponding servlet context init parameter or system property values.
- 
Constructor Details- 
ServletContextPropertyUtilspublic ServletContextPropertyUtils()
 
- 
- 
Method Details- 
resolvePlaceholdersResolve ${...} placeholders in the given text, replacing them with corresponding servlet context init parameter or system property values.- Parameters:
- text- the String to resolve
- servletContext- the servletContext to use for lookups.
- Returns:
- the resolved String
- Throws:
- IllegalArgumentException- if there is an unresolvable placeholder
- See Also:
 
- 
resolvePlaceholderspublic 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. Unresolvable placeholders with no default value are ignored and passed through unchanged if the flag is set to true.- Parameters:
- text- the String to resolve
- servletContext- the servletContext to use for lookups.
- ignoreUnresolvablePlaceholders- flag to determine is unresolved placeholders are ignored
- Returns:
- the resolved String
- Throws:
- IllegalArgumentException- if there is an unresolvable placeholder and the flag is- false
- See Also:
 
 
-