Package org.opencms.jsp.util
Class CmsKeyDummyMacroResolver
java.lang.Object
org.opencms.util.CmsMacroResolver
org.opencms.jsp.util.CmsKeyDummyMacroResolver
- All Implemented Interfaces:
I_CmsMacroResolver
Macro resolver used to temporarily replace localization message macros with random UUIDs and then replace the UUIDs
with the original key after all other macro processing has happened.
We need this because we want to preserve the message key, but evaluate macros they may be nested in.
-
Field Summary
Fields inherited from class org.opencms.util.CmsMacroResolver
KEY_ATTRIBUTE, KEY_CONTEXT_PATH, KEY_CURRENT_ORGUNIT_DESCRIPTION, KEY_CURRENT_ORGUNIT_FQN, KEY_CURRENT_TIME, KEY_CURRENT_USER_CITY, KEY_CURRENT_USER_COUNTRY, KEY_CURRENT_USER_DISPLAYNAME, KEY_CURRENT_USER_EMAIL, KEY_CURRENT_USER_FIRSTNAME, KEY_CURRENT_USER_FULLNAME, KEY_CURRENT_USER_INSTITUTION, KEY_CURRENT_USER_LASTLOGIN, KEY_CURRENT_USER_LASTNAME, KEY_CURRENT_USER_NAME, KEY_CURRENT_USER_STREET, KEY_CURRENT_USER_ZIP, KEY_LOCALIZED_PREFIX, KEY_OPENCMS, KEY_PAGE_CONTEXT, KEY_PARAM, KEY_PROJECT_ID, KEY_PROPERTY, KEY_PROPERTY_ELEMENT, KEY_RANDOM_ID, KEY_REQUEST_ENCODING, KEY_REQUEST_FOLDER, KEY_REQUEST_LOCALE, KEY_REQUEST_PARAM, KEY_REQUEST_SITEROOT, KEY_REQUEST_URI, KEY_SITEMAP_ATTRIBUTE, KEY_VALIDATION_PATH, KEY_VALIDATION_REGEX, KEY_VALIDATION_VALUE, m_additionalMacros, m_cms, m_jspPageContext, m_keepEmptyMacros, m_messages, m_parameterMap, m_resourceName, VALUE_NAMES
Fields inherited from interface org.opencms.util.I_CmsMacroResolver
MACRO_DELIMITER, MACRO_DELIMITER_OLD, MACRO_END, MACRO_END_OLD, MACRO_START, MACRO_START_OLD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Extracts the message from a string of the form %(key.{message}), or returns null if the input string does not have this form.static String
getKey
(String s, CmsMacroResolver delegate) Gets the localization key name of a (potentially nested) key macro in a base string.getMacroValue
(String macro) Resolves a single macro to the macro value, returnsnull
if the macro could not be resolved.resolveMacros
(String input) Resolves the macros in the given input.Methods inherited from class org.opencms.util.CmsMacroResolver
addDynamicMacro, addMacro, copyAndResolveMacro, copyAndResolveMacro, copyAndResolveMacro, formatMacro, getBundleMapFromResources, isKeepEmptyMacros, isMacro, isMacro, localizedKeyMacro, newInstance, newWorkplaceLocaleResolver, resolveMacros, resolveMacros, setAdditionalMacros, setCmsObject, setJspPageContext, setKeepEmptyMacros, setMessages, setParameterMap, setResourceName, stripMacro, toFunction
-
Field Details
-
PATTERN_MESSAGE
Pattern to match message key macros.
-
-
Constructor Details
-
CmsKeyDummyMacroResolver
Creates a new instance- Parameters:
delegate
- the macro resolver to delegate to
-
-
Method Details
-
getKey
Extracts the message from a string of the form %(key.{message}), or returns null if the input string does not have this form.- Parameters:
s
- the input string- Returns:
- the key the extracted message key
-
getKey
Gets the localization key name of a (potentially nested) key macro in a base string.- Parameters:
s
- the base stringdelegate
- the macro resolver used to resolve macros which the key macro may be nested in- Returns:
- the localization key
-
getMacroValue
Description copied from interface:I_CmsMacroResolver
Resolves a single macro to the macro value, returnsnull
if the macro could not be resolved.- Specified by:
getMacroValue
in interfaceI_CmsMacroResolver
- Overrides:
getMacroValue
in classCmsMacroResolver
- Parameters:
macro
- the macro to resolve- Returns:
- the resolved macro or
null
if the macro could not be resolved - See Also:
-
resolveMacros
Description copied from class:CmsMacroResolver
Resolves the macros in the given input.Calls
until no more macros can be resolved in the input. This way "nested" macros in the input are resolved as well.CmsMacroResolver.resolveMacros(String)
- Specified by:
resolveMacros
in interfaceI_CmsMacroResolver
- Overrides:
resolveMacros
in classCmsMacroResolver
- Parameters:
input
- the input to resolve the macros in- Returns:
- the input with all macros resolved
- See Also:
-