From 0c2d275dc2d9c3ac66121c29e50010e1e071cd4f Mon Sep 17 00:00:00 2001 From: Lukasz Lenart Date: Sun, 3 Nov 2024 00:05:49 +0100 Subject: [PATCH] WW-5482 Moves locale related code into org.apache.struts2.locale --- .../org/apache/struts2/ActionSupport.java | 2 + .../org/apache/struts2/StrutsConstants.java | 383 +++++++++++++----- .../org/apache/struts2/components/I18n.java | 4 +- .../config/StrutsBeanSelectionProvider.java | 2 +- .../config/impl/DefaultConfiguration.java | 4 +- .../conversion/impl/DefaultTypeConverter.java | 2 +- .../apache/struts2/dispatcher/Dispatcher.java | 2 +- .../multipart/MultiPartRequestWrapper.java | 2 +- .../AbstractFileUploadInterceptor.java | 4 +- .../struts2/interceptor/I18nInterceptor.java | 5 +- .../{ => locale}/DefaultLocaleProvider.java | 3 +- .../DefaultLocaleProviderFactory.java | 2 +- .../struts2/{ => locale}/LocaleProvider.java | 9 +- .../{ => locale}/LocaleProviderFactory.java | 4 +- .../text/ResourceBundleTextProvider.java | 2 +- .../text/StrutsTextProviderFactory.java | 2 +- .../org/apache/struts2/text/TextProvider.java | 7 +- .../struts2/text/TextProviderSupport.java | 4 +- .../validator/DelegatingValidatorContext.java | 4 +- .../struts2/validator/ValidatorContext.java | 2 +- .../views/freemarker/FreemarkerResult.java | 2 +- core/src/main/resources/struts-beans.xml | 4 +- .../apache/struts2/LocaleProviderTest.java | 1 + ...onfigurationProviderOgnlAllowlistTest.java | 6 +- .../ActionFileUploadInterceptorTest.java | 2 +- .../interceptor/I18nInterceptorTest.java | 2 +- .../DefaultLocaleProviderTest.java | 3 +- .../struts2/text/TextProviderSupportTest.java | 2 +- .../tiles/StrutsTilesLocaleResolver.java | 2 +- 29 files changed, 333 insertions(+), 140 deletions(-) rename core/src/main/java/org/apache/struts2/{ => locale}/DefaultLocaleProvider.java (96%) rename core/src/main/java/org/apache/struts2/{ => locale}/DefaultLocaleProviderFactory.java (96%) rename core/src/main/java/org/apache/struts2/{ => locale}/LocaleProvider.java (96%) rename core/src/main/java/org/apache/struts2/{ => locale}/LocaleProviderFactory.java (94%) rename core/src/test/java/org/apache/struts2/{ => locale}/DefaultLocaleProviderTest.java (98%) diff --git a/core/src/main/java/org/apache/struts2/ActionSupport.java b/core/src/main/java/org/apache/struts2/ActionSupport.java index 6da71ae399..578da01673 100644 --- a/core/src/main/java/org/apache/struts2/ActionSupport.java +++ b/core/src/main/java/org/apache/struts2/ActionSupport.java @@ -25,6 +25,8 @@ import org.apache.struts2.inject.Container; import org.apache.struts2.inject.Inject; import org.apache.struts2.interceptor.ValidationAware; +import org.apache.struts2.locale.LocaleProvider; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.TextProvider; import org.apache.struts2.text.TextProviderFactory; import org.apache.struts2.util.ValueStack; diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java index 85064e702f..ae722ae4d2 100644 --- a/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java @@ -19,8 +19,6 @@ package org.apache.struts2; import org.apache.struts2.components.date.DateFormatter; -import org.apache.struts2.conversion.impl.XWorkBasicConverter; -import org.apache.struts2.dispatcher.mapper.CompositeActionMapper; /** * This class provides a central location for framework configuration keys @@ -28,13 +26,19 @@ */ public final class StrutsConstants { - /** Whether Struts is in development mode or not */ + /** + * Whether Struts is in development mode or not + */ public static final String STRUTS_DEVMODE = "struts.devMode"; - /** Whether the localization messages should automatically be reloaded */ + /** + * Whether the localization messages should automatically be reloaded + */ public static final String STRUTS_I18N_RELOAD = "struts.i18n.reload"; - /** The encoding to use for localization messages */ + /** + * The encoding to use for localization messages + */ public static final String STRUTS_I18N_ENCODING = "struts.i18n.encoding"; /** @@ -48,33 +52,51 @@ public final class StrutsConstants { */ public static final String STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST = "struts.i18n.search.defaultbundles.first"; - /** Whether to reload the XML configuration or not */ + /** + * Whether to reload the XML configuration or not + */ public static final String STRUTS_CONFIGURATION_XML_RELOAD = "struts.configuration.xml.reload"; - /** The URL extension to use to determine if the request is meant for a Struts action */ + /** + * The URL extension to use to determine if the request is meant for a Struts action + */ public static final String STRUTS_ACTION_EXTENSION = "struts.action.extension"; - /** Comma separated list of patterns (java.util.regex.Pattern) to be excluded from Struts2-processing */ + /** + * Comma separated list of patterns (java.util.regex.Pattern) to be excluded from Struts2-processing + */ public static final String STRUTS_ACTION_EXCLUDE_PATTERN = "struts.action.excludePattern"; - /** A custom separator used to split list of patterns (java.util.regex.Pattern) to be excluded from Struts2-processing */ + /** + * A custom separator used to split list of patterns (java.util.regex.Pattern) to be excluded from Struts2-processing + */ public static final String STRUTS_ACTION_EXCLUDE_PATTERN_SEPARATOR = "struts.action.excludePattern.separator"; - /** Whether to use the response encoding (JSP page encoding) for s:include tag processing (false - use STRUTS_I18N_ENCODING - by default) */ + /** + * Whether to use the response encoding (JSP page encoding) for s:include tag processing (false - use STRUTS_I18N_ENCODING - by default) + */ public static final String STRUTS_TAG_INCLUDETAG_USERESPONSEENCODING = "struts.tag.includetag.useResponseEncoding"; - /** The HTTP port used by Struts URLs */ + /** + * The HTTP port used by Struts URLs + */ public static final String STRUTS_URL_HTTP_PORT = "struts.url.http.port"; - /** The HTTPS port used by Struts URLs */ + /** + * The HTTPS port used by Struts URLs + */ public static final String STRUTS_URL_HTTPS_PORT = "struts.url.https.port"; - /** The default includeParams method to generate Struts URLs */ + /** + * The default includeParams method to generate Struts URLs + */ public static final String STRUTS_URL_INCLUDEPARAMS = "struts.url.includeParams"; public static final String STRUTS_URL_RENDERER = "struts.urlRenderer"; - /** The org.apache.struts2.ObjectFactory implementation class */ + /** + * The org.apache.struts2.ObjectFactory implementation class + */ public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory"; public static final String STRUTS_OBJECTFACTORY_ACTIONFACTORY = "struts.objectFactory.actionFactory"; public static final String STRUTS_OBJECTFACTORY_RESULTFACTORY = "struts.objectFactory.resultFactory"; @@ -83,83 +105,134 @@ public final class StrutsConstants { public static final String STRUTS_OBJECTFACTORY_VALIDATORFACTORY = "struts.objectFactory.validatorFactory"; public static final String STRUTS_OBJECTFACTORY_UNKNOWNHANDLERFACTORY = "struts.objectFactory.unknownHandlerFactory"; - /** The org.apache.struts2.util.FileManager implementation class */ + /** + * The org.apache.struts2.util.FileManager implementation class + */ public static final String STRUTS_FILE_MANAGER_FACTORY = "struts.fileManagerFactory"; - /** The org.apache.struts2.util.fs.FileManager implementation class */ + /** + * The org.apache.struts2.util.fs.FileManager implementation class + */ public static final String STRUTS_FILE_MANAGER = "struts.fileManager"; - /** The org.apache.struts2.util.ObjectTypeDeterminer implementation class */ + /** + * The org.apache.struts2.util.ObjectTypeDeterminer implementation class + */ public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer"; - /** The package containing actions that use Rife continuations */ + /** + * The package containing actions that use Rife continuations + */ public static final String STRUTS_CONTINUATIONS_PACKAGE = "struts.continuations.package"; - /** The org.apache.struts2.config.Configuration implementation class */ + /** + * The org.apache.struts2.config.Configuration implementation class + */ public static final String STRUTS_CONFIGURATION = "struts.configuration"; - /** The default locale for the Struts application */ + /** + * The default locale for the Struts application + */ public static final String STRUTS_LOCALE = "struts.locale"; - /** Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic */ + /** + * Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic + */ public static final String STRUTS_DISPATCHER_PARAMETERSWORKAROUND = "struts.dispatcher.parametersWorkaround"; - /** The org.apache.struts2.views.freemarker.FreemarkerManager implementation class */ + /** + * The org.apache.struts2.views.freemarker.FreemarkerManager implementation class + */ public static final String STRUTS_FREEMARKER_MANAGER_CLASSNAME = "struts.freemarker.manager.classname"; - /** Update freemarker templates cache in seconds */ + /** + * Update freemarker templates cache in seconds + */ public static final String STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY = "struts.freemarker.templatesCache.updateDelay"; - /** Cache model instances at BeanWrapper level */ + /** + * Cache model instances at BeanWrapper level + */ public static final String STRUTS_FREEMARKER_BEANWRAPPER_CACHE = "struts.freemarker.beanwrapperCache"; - /** Maximum strong sizing for MruCacheStorage for freemarker */ + /** + * Maximum strong sizing for MruCacheStorage for freemarker + */ public static final String STRUTS_FREEMARKER_MRU_MAX_STRONG_SIZE = "struts.freemarker.mru.max.strong.size"; - /** The Velocity configuration file path */ + /** + * The Velocity configuration file path + */ public static final String STRUTS_VELOCITY_CONFIGFILE = "struts.velocity.configfile"; - /** The location of the Velocity toolbox */ + /** + * The location of the Velocity toolbox + */ public static final String STRUTS_VELOCITY_TOOLBOXLOCATION = "struts.velocity.toolboxlocation"; - /** List of Velocity context names */ + /** + * List of Velocity context names + */ public static final String STRUTS_VELOCITY_CONTEXTS = "struts.velocity.contexts"; - /** The directory containing UI templates. All templates must reside in this directory. */ + /** + * The directory containing UI templates. All templates must reside in this directory. + */ public static final String STRUTS_UI_TEMPLATEDIR = "struts.ui.templateDir"; - /** The default UI template theme */ + /** + * The default UI template theme + */ public static final String STRUTS_UI_THEME = "struts.ui.theme"; - /** Token to use to indicate start of theme to be expanded. */ + /** + * Token to use to indicate start of theme to be expanded. + */ public static final String STRUTS_UI_THEME_EXPANSION_TOKEN = "struts.ui.theme.expansion.token"; - /** A path to static content, by default and from historical point of view it's /static. */ + /** + * A path to static content, by default and from historical point of view it's /static. + */ public static final String STRUTS_UI_STATIC_CONTENT_PATH = "struts.ui.staticContentPath"; - /** A global flag to enable/disable html body escaping in tags, can be overwritten per tag */ + /** + * A global flag to enable/disable html body escaping in tags, can be overwritten per tag + */ public static final String STRUTS_UI_ESCAPE_HTML_BODY = "struts.ui.escapeHtmlBody"; - /** The maximum size of a multipart request (file upload) */ + /** + * The maximum size of a multipart request (file upload) + */ public static final String STRUTS_MULTIPART_MAX_SIZE = "struts.multipart.maxSize"; - /** The maximum size of all uploaded files. - Used only with {@link org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest} */ + /** + * The maximum size of all uploaded files. + * Used only with {@link org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest} + */ public static final String STRUTS_MULTIPART_MAX_SIZE_OF_FILES = "struts.multipart.maxSizeOfFiles"; - /** The maximum number of files allowed in a multipart request */ + /** + * The maximum number of files allowed in a multipart request + */ public static final String STRUTS_MULTIPART_MAX_FILES = "struts.multipart.maxFiles"; - /** The maximum length of a string parameter in a multipart request. */ + /** + * The maximum length of a string parameter in a multipart request. + */ public static final String STRUTS_MULTIPART_MAX_STRING_LENGTH = "struts.multipart.maxStringLength"; - /** The maximum size per file in a multipart request */ + /** + * The maximum size per file in a multipart request + */ public static final String STRUTS_MULTIPART_MAX_FILE_SIZE = "struts.multipart.maxFileSize"; - /** The directory to use for storing uploaded files */ + /** + * The directory to use for storing uploaded files + */ public static final String STRUTS_MULTIPART_SAVE_DIR = "struts.multipart.saveDir"; - /** Declares the buffer size to be used during streaming multipart content to disk. + /** + * Declares the buffer size to be used during streaming multipart content to disk. * Used only with {@link org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest} */ public static final String STRUTS_MULTIPART_BUFFER_SIZE = "struts.multipart.bufferSize"; @@ -177,29 +250,43 @@ public final class StrutsConstants { public static final String STRUTS_MULTIPART_VALIDATION_REGEX = "struts.multipart.validationRegex"; - /** How Spring should autowire. Valid values are 'name', 'type', 'auto', and 'constructor' */ + /** + * How Spring should autowire. Valid values are 'name', 'type', 'auto', and 'constructor' + */ public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE = "struts.objectFactory.spring.autoWire"; - /** Whether the autowire strategy chosen by STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE is always respected. Defaults + /** + * Whether the autowire strategy chosen by STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE is always respected. Defaults * to false, which is the legacy behavior that tries to determine the best strategy for the situation. + * * @since 2.1.3 */ public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE_ALWAYS_RESPECT = "struts.objectFactory.spring.autoWire.alwaysRespect"; - /** Whether Spring should use its class cache or not */ + /** + * Whether Spring should use its class cache or not + */ public static final String STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE = "struts.objectFactory.spring.useClassCache"; - /** Uses different logic to construct beans, see https://issues.apache.org/jira/browse/WW-4110 */ + /** + * Uses different logic to construct beans, see https://issues.apache.org/jira/browse/WW-4110 + */ @Deprecated public static final String STRUTS_OBJECTFACTORY_SPRING_ENABLE_AOP_SUPPORT = "struts.objectFactory.spring.enableAopSupport"; - /** Location of additional configuration properties files to load */ + /** + * Location of additional configuration properties files to load + */ public static final String STRUTS_CUSTOM_PROPERTIES = "struts.custom.properties"; - /** Location of additional localization properties files to load */ + /** + * Location of additional localization properties files to load + */ public static final String STRUTS_CUSTOM_I18N_RESOURCES = "struts.custom.i18n.resources"; - /** A name of a bean implementing org.apache.struts2.dispatcher.mapper.ActionMapper interface */ + /** + * A name of a bean implementing org.apache.struts2.dispatcher.mapper.ActionMapper interface + */ public static final String STRUTS_MAPPER_CLASS = "struts.mapper.class"; /** @@ -209,45 +296,70 @@ public final class StrutsConstants { */ public static final String PREFIX_BASED_MAPPER_CONFIGURATION = "struts.mapper.prefixMapping"; - /** Whether the Struts filter should serve static content or not */ + /** + * Whether the Struts filter should serve static content or not + */ public static final String STRUTS_SERVE_STATIC_CONTENT = "struts.serve.static"; - /** If static content served by the Struts filter should set browser caching header properties or not */ + /** + * If static content served by the Struts filter should set browser caching header properties or not + */ public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = "struts.serve.static.browserCache"; - /** Allows one to disable dynamic method invocation from the URL */ + /** + * Allows one to disable dynamic method invocation from the URL + */ public static final String STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION = "struts.enable.DynamicMethodInvocation"; - /** Whether slashes in action names are allowed or not */ + /** + * Whether slashes in action names are allowed or not + */ public static final String STRUTS_ENABLE_SLASHES_IN_ACTION_NAMES = "struts.enable.SlashesInActionNames"; - /** Prefix used by {@link CompositeActionMapper} to identify its containing {@link org.apache.struts2.dispatcher.mapper.ActionMapper} class. */ + /** + * Prefix used by {@link org.apache.struts2.dispatcher.mapper.CompositeActionMapper} to identify + * its containing {@link org.apache.struts2.dispatcher.mapper.ActionMapper} class. + */ public static final String STRUTS_MAPPER_COMPOSITE = "struts.mapper.composite"; public static final String STRUTS_ACTIONPROXYFACTORY = "struts.actionProxyFactory"; public static final String STRUTS_FREEMARKER_WRAPPER_ALT_MAP = "struts.freemarker.wrapper.altMap"; - /** Extension point for the Struts CompoundRootAccessor */ + /** + * Extension point for the Struts CompoundRootAccessor + */ public static final String STRUTS_COMPOUND_ROOT_ACCESSOR = "struts.compoundRootAccessor"; - /** Extension point for the Struts MethodAccessor */ + /** + * Extension point for the Struts MethodAccessor + */ public static final String STRUTS_METHOD_ACCESSOR = "struts.methodAccessor"; - /** The name of the xwork converter implementation */ + /** + * The name of the xwork converter implementation + */ public static final String STRUTS_XWORKCONVERTER = "struts.xworkConverter"; public static final String STRUTS_ALWAYS_SELECT_FULL_NAMESPACE = "struts.mapper.alwaysSelectFullNamespace"; - /** Fallback to empty namespace when request namespace didn't match any in action configuration */ + /** + * Fallback to empty namespace when request namespace didn't match any in action configuration + */ public static final String STRUTS_ACTION_CONFIG_FALLBACK_TO_EMPTY_NAMESPACE = "struts.actionConfig.fallbackToEmptyNamespace"; - /** The {@link org.apache.struts2.LocaleProviderFactory} implementation class */ + /** + * The {@link org.apache.struts2.locale.LocaleProviderFactory} implementation class + */ public static final String STRUTS_LOCALE_PROVIDER_FACTORY = "struts.localeProviderFactory"; - /** The name of the parameter to create when mapping an id (used by some action mappers) */ + /** + * The name of the parameter to create when mapping an id (used by some action mappers) + */ public static final String STRUTS_ID_PARAMETER_NAME = "struts.mapper.idParameterName"; - /** The name of the parameter to determine whether static field access will be allowed in OGNL expressions or not */ + /** + * The name of the parameter to determine whether static field access will be allowed in OGNL expressions or not + */ public static final String STRUTS_ALLOW_STATIC_FIELD_ACCESS = "struts.ognl.allowStaticFieldAccess"; public static final String STRUTS_DISALLOW_CUSTOM_OGNL_MAP = "struts.ognl.disallowCustomOgnlMap"; @@ -256,28 +368,44 @@ public final class StrutsConstants { public static final String STRUTS_OGNL_GUARD = "struts.ognlGuard"; - /** The org.apache.struts2.validator.ActionValidatorManager implementation class */ + /** + * The org.apache.struts2.validator.ActionValidatorManager implementation class + */ public static final String STRUTS_ACTIONVALIDATORMANAGER = "struts.actionValidatorManager"; - /** The {@link org.apache.struts2.util.ValueStackFactory} implementation class */ + /** + * The {@link org.apache.struts2.util.ValueStackFactory} implementation class + */ public static final String STRUTS_VALUESTACKFACTORY = "struts.valueStackFactory"; - /** The {@link org.apache.struts2.util.reflection.ReflectionProvider} implementation class */ + /** + * The {@link org.apache.struts2.util.reflection.ReflectionProvider} implementation class + */ public static final String STRUTS_REFLECTIONPROVIDER = "struts.reflectionProvider"; - /** The {@link org.apache.struts2.util.reflection.ReflectionContextFactory} implementation class */ + /** + * The {@link org.apache.struts2.util.reflection.ReflectionContextFactory} implementation class + */ public static final String STRUTS_REFLECTIONCONTEXTFACTORY = "struts.reflectionContextFactory"; - /** The {@link org.apache.struts2.util.PatternMatcher} implementation class */ + /** + * The {@link org.apache.struts2.util.PatternMatcher} implementation class + */ public static final String STRUTS_PATTERNMATCHER = "struts.patternMatcher"; - /** The {@link org.apache.struts2.dispatcher.StaticContentLoader} implementation class */ + /** + * The {@link org.apache.struts2.dispatcher.StaticContentLoader} implementation class + */ public static final String STRUTS_STATIC_CONTENT_LOADER = "struts.staticContentLoader"; - /** The {@link org.apache.struts2.UnknownHandlerManager} implementation class */ + /** + * The {@link org.apache.struts2.UnknownHandlerManager} implementation class + */ public static final String STRUTS_UNKNOWN_HANDLER_MANAGER = "struts.unknownHandlerManager"; - /** Throw RuntimeException when a property is not found, or the evaluation of the expression fails */ + /** + * Throw RuntimeException when a property is not found, or the evaluation of the expression fails + */ public static final String STRUTS_EL_THROW_EXCEPTION = "struts.el.throwExceptionOnFailure"; /** @@ -298,8 +426,9 @@ public final class StrutsConstants { /** * Specifies the type of cache to use for BeanInfo objects. - * @since 6.4.0 + * * @see StrutsConstants#STRUTS_OGNL_EXPRESSION_CACHE_TYPE + * @since 6.4.0 */ public static final String STRUTS_OGNL_BEANINFO_CACHE_TYPE = "struts.ognl.beanInfoCacheType"; @@ -313,6 +442,7 @@ public final class StrutsConstants { /** * Logs properties that are not found (very verbose) + * * @since 6.0.0 */ public static final String STRUTS_OGNL_LOG_MISSING_PROPERTIES = "struts.ognl.logMissingProperties"; @@ -327,6 +457,7 @@ public final class StrutsConstants { /** * Enables caching of parsed OGNL expressions + * * @since 6.0.0 */ public static final String STRUTS_OGNL_ENABLE_EXPRESSION_CACHE = "struts.ognl.enableExpressionCache"; @@ -341,6 +472,7 @@ public final class StrutsConstants { *
  • For the LRU cache, once the maximum cache size is reached, the least-recently-used entry will be removed. *
  • * + * * @since 6.4.0 */ public static final String STRUTS_OGNL_EXPRESSION_CACHE_TYPE = "struts.ognl.expressionCacheType"; @@ -355,30 +487,43 @@ public final class StrutsConstants { /** * Enables evaluation of OGNL expressions + * * @since 6.0.0 */ public static final String STRUTS_OGNL_ENABLE_EVAL_EXPRESSION = "struts.ognl.enableEvalExpression"; - /** The maximum length of an expression (OGNL) */ + /** + * The maximum length of an expression (OGNL) + */ public static final String STRUTS_OGNL_EXPRESSION_MAX_LENGTH = "struts.ognl.expressionMaxLength"; - /** Parsed OGNL expressions which contain these node types will be blocked */ + /** + * Parsed OGNL expressions which contain these node types will be blocked + */ public static final String STRUTS_OGNL_EXCLUDED_NODE_TYPES = "struts.ognl.excludedNodeTypes"; - /** Disables {@link org.apache.struts2.dispatcher.StrutsRequestWrapper} request attribute value stack lookup (JSTL accessibility) */ + /** + * Disables {@link org.apache.struts2.dispatcher.StrutsRequestWrapper} request attribute value stack lookup (JSTL accessibility) + */ public static final String STRUTS_DISABLE_REQUEST_ATTRIBUTE_VALUE_STACK_LOOKUP = "struts.disableRequestAttributeValueStackLookup"; - /** The{@link org.apache.struts2.views.util.UrlHelper} implementation class */ + /** + * The{@link org.apache.struts2.views.util.UrlHelper} implementation class + */ public static final String STRUTS_URL_HELPER = "struts.view.urlHelper"; - /** {@link XWorkBasicConverter} */ + /** + * {@link org.apache.struts2.conversion.impl.XWorkBasicConverter} + */ public static final String STRUTS_CONVERTER_COLLECTION = "struts.converter.collection"; public static final String STRUTS_CONVERTER_ARRAY = "struts.converter.array"; public static final String STRUTS_CONVERTER_DATE = "struts.converter.date"; public static final String STRUTS_CONVERTER_NUMBER = "struts.converter.number"; public static final String STRUTS_CONVERTER_STRING = "struts.converter.string"; - /** Enable handling exceptions by Dispatcher - true by default */ + /** + * Enable handling exceptions by Dispatcher - true by default + */ public static final String STRUTS_HANDLE_EXCEPTION = "struts.handle.exception"; public static final String STRUTS_CONVERTER_PROPERTIES_PROCESSOR = "struts.converter.properties.processor"; @@ -389,57 +534,93 @@ public final class StrutsConstants { public static final String STRUTS_EXPRESSION_PARSER = "struts.expression.parser"; - /** Namespace names' whitelist */ + /** + * Namespace names' whitelist + */ public static final String STRUTS_ALLOWED_NAMESPACE_NAMES = "struts.allowed.namespace.names"; - /** Default namespace name to use when namespace didn't match the whitelist */ + /** + * Default namespace name to use when namespace didn't match the whitelist + */ public static final String STRUTS_DEFAULT_NAMESPACE_NAME = "struts.default.namespace.name"; - /** Action names' whitelist */ + /** + * Action names' whitelist + */ public static final String STRUTS_ALLOWED_ACTION_NAMES = "struts.allowed.action.names"; - /** Default action name to use when action didn't match the whitelist */ + /** + * Default action name to use when action didn't match the whitelist + */ public static final String STRUTS_DEFAULT_ACTION_NAME = "struts.default.action.name"; - /** Method names' whitelist */ + /** + * Method names' whitelist + */ public static final String STRUTS_ALLOWED_METHOD_NAMES = "struts.allowed.method.names"; - /** Default method name to use when method didn't match the whitelist */ + /** + * Default method name to use when method didn't match the whitelist + */ public static final String STRUTS_DEFAULT_METHOD_NAME = "struts.default.method.name"; - /** Enables action: prefix */ + /** + * Enables action: prefix + */ public static final String STRUTS_MAPPER_ACTION_PREFIX_ENABLED = "struts.mapper.action.prefix.enabled"; public static final String DEFAULT_TEMPLATE_TYPE_CONFIG_KEY = "struts.ui.templateSuffix"; - /** Allows override default DispatcherErrorHandler */ + /** + * Allows override default DispatcherErrorHandler + */ public static final String STRUTS_DISPATCHER_ERROR_HANDLER = "struts.dispatcher.errorHandler"; - /** Comma delimited set of excluded classes which cannot be accessed via OGNL expressions. Matching is done on both target and member classes of OGNL expression. Note that superclasses of listed classes are also used for matching. */ + /** + * Comma delimited set of excluded classes which cannot be accessed via OGNL expressions. Matching is done on both target and member classes of OGNL expression. Note that superclasses of listed classes are also used for matching. + */ public static final String STRUTS_EXCLUDED_CLASSES = "struts.excludedClasses"; - /** Comma delimited set of RegEx to match against package names of target and member classes of OGNL expressions. If matched, they cannot be accessed. */ + /** + * Comma delimited set of RegEx to match against package names of target and member classes of OGNL expressions. If matched, they cannot be accessed. + */ public static final String STRUTS_EXCLUDED_PACKAGE_NAME_PATTERNS = "struts.excludedPackageNamePatterns"; - /** Comma delimited set of package names, of which all its classes, and all classes in its subpackages, cannot be accessed via OGNL expressions. Matching is done on both target and member classes of OGNL expression. */ + /** + * Comma delimited set of package names, of which all its classes, and all classes in its subpackages, cannot be accessed via OGNL expressions. Matching is done on both target and member classes of OGNL expression. + */ public static final String STRUTS_EXCLUDED_PACKAGE_NAMES = "struts.excludedPackageNames"; - /** Comma delimited set of exempt classes from matching against excludedPackageNames and excludedPackageNamePatterns. As matching for excluded packages is done on both target and member classes of OGNL expression, an exemption must exist for each match. */ + /** + * Comma delimited set of exempt classes from matching against excludedPackageNames and excludedPackageNamePatterns. As matching for excluded packages is done on both target and member classes of OGNL expression, an exemption must exist for each match. + */ public static final String STRUTS_EXCLUDED_PACKAGE_EXEMPT_CLASSES = "struts.excludedPackageExemptClasses"; - /** Comma delimited set of excluded classes and package names which cannot be accessed via expressions in devMode */ + /** + * Comma delimited set of excluded classes and package names which cannot be accessed via expressions in devMode + */ public static final String STRUTS_DEV_MODE_EXCLUDED_CLASSES = "struts.devMode.excludedClasses"; public static final String STRUTS_DEV_MODE_EXCLUDED_PACKAGE_NAME_PATTERNS = "struts.devMode.excludedPackageNamePatterns"; public static final String STRUTS_DEV_MODE_EXCLUDED_PACKAGE_NAMES = "struts.devMode.excludedPackageNames"; public static final String STRUTS_DEV_MODE_EXCLUDED_PACKAGE_EXEMPT_CLASSES = "struts.devMode.excludedPackageExemptClasses"; - /** Boolean to enable strict allowlist processing of all OGNL expression calls. */ + /** + * Boolean to enable strict allowlist processing of all OGNL expression calls. + */ public static final String STRUTS_ALLOWLIST_ENABLE = "struts.allowlist.enable"; - /** Comma delimited set of allowed classes which CAN be accessed via OGNL expressions. Both target and member classes of OGNL expression must be allowlisted. */ + /** + * Comma delimited set of allowed classes which CAN be accessed via OGNL expressions. Both target and member classes of OGNL expression must be allowlisted. + */ public static final String STRUTS_ALLOWLIST_CLASSES = "struts.allowlist.classes"; - /** Comma delimited set of package names, of which all its classes, and all classes in its subpackages, CAN be accessed via OGNL expressions. Both target and member classes of OGNL expression must be allowlisted. */ + /** + * Comma delimited set of package names, of which all its classes, and all classes in its subpackages, CAN be accessed via OGNL expressions. Both target and member classes of OGNL expression must be allowlisted. + */ public static final String STRUTS_ALLOWLIST_PACKAGE_NAMES = "struts.allowlist.packageNames"; - /** Dedicated services to check if passed string is excluded/accepted */ + /** + * Dedicated services to check if passed string is excluded/accepted + */ public static final String STRUTS_EXCLUDED_PATTERNS_CHECKER = "struts.excludedPatterns.checker"; public static final String STRUTS_ACCEPTED_PATTERNS_CHECKER = "struts.acceptedPatterns.checker"; public static final String STRUTS_NOT_EXCLUDED_ACCEPTED_PATTERNS_CHECKER = "struts.notExcludedAcceptedPatterns.checker"; - /** Constant is used to override framework's default excluded patterns */ + /** + * Constant is used to override framework's default excluded patterns + */ public static final String STRUTS_OVERRIDE_EXCLUDED_PATTERNS = "struts.override.excludedPatterns"; public static final String STRUTS_OVERRIDE_ACCEPTED_PATTERNS = "struts.override.acceptedPatterns"; @@ -463,7 +644,9 @@ public final class StrutsConstants { public static final String STRUTS_OGNL_AUTO_GROWTH_COLLECTION_LIMIT = "struts.ognl.autoGrowthCollectionLimit"; - /** See {@link org.apache.struts2.config.impl.AbstractMatcher#appendNamedParameters */ + /** + * See {@link org.apache.struts2.config.impl.AbstractMatcher#appendNamedParameters + */ public static final String STRUTS_MATCHER_APPEND_NAMED_PARAMETERS = "struts.matcher.appendNamedParameters"; public static final String STRUTS_CHAINING_COPY_ERRORS = "struts.chaining.copyErrors"; @@ -471,7 +654,9 @@ public final class StrutsConstants { public static final String STRUTS_CHAINING_COPY_MESSAGES = "struts.chaining.copyMessages"; public static final String STRUTS_OBJECT_FACTORY_CLASSLOADER = "struts.objectFactory.classloader"; - /** See {@link org.apache.struts2.components.Date#setDateFormatter(DateFormatter)} */ + /** + * See {@link org.apache.struts2.components.Date#setDateFormatter(DateFormatter)} + */ public static final String STRUTS_DATE_FORMATTER = "struts.date.formatter"; public static final String STRUTS_URL_QUERY_STRING_BUILDER = "struts.url.queryStringBuilder"; @@ -479,9 +664,13 @@ public final class StrutsConstants { public static final String STRUTS_URL_ENCODER = "struts.url.encoder"; public static final String STRUTS_URL_DECODER = "struts.url.decoder"; - /** A global flag to set property {@link org.apache.struts2.components.Checkbox#setSubmitUnchecked(String)} */ + /** + * A global flag to set property {@link org.apache.struts2.components.Checkbox#setSubmitUnchecked(String)} + */ public static final String STRUTS_UI_CHECKBOX_SUBMIT_UNCHECKED = "struts.ui.checkbox.submitUnchecked"; - /** See {@link org.apache.struts2.interceptor.exec.ExecutorProvider} */ + /** + * See {@link org.apache.struts2.interceptor.exec.ExecutorProvider} + */ public static final String STRUTS_EXECUTOR_PROVIDER = "struts.executor.provider"; } diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java index d8ef748da5..64e002a361 100644 --- a/core/src/main/java/org/apache/struts2/components/I18n.java +++ b/core/src/main/java/org/apache/struts2/components/I18n.java @@ -21,14 +21,14 @@ import java.io.Writer; import java.util.ResourceBundle; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.LocalizedTextProvider; import org.apache.struts2.text.TextProviderFactory; import org.apache.struts2.views.annotations.StrutsTag; import org.apache.struts2.views.annotations.StrutsTagAttribute; import org.apache.struts2.StrutsException; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import org.apache.struts2.text.TextProvider; import org.apache.struts2.inject.Inject; import org.apache.struts2.util.ValueStack; diff --git a/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java index a31b358967..ace7b68753 100644 --- a/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java +++ b/core/src/main/java/org/apache/struts2/config/StrutsBeanSelectionProvider.java @@ -22,7 +22,7 @@ import org.apache.struts2.ActionProxyFactory; import org.apache.struts2.FileManager; import org.apache.struts2.FileManagerFactory; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.LocalizedTextProvider; import org.apache.struts2.ObjectFactory; import org.apache.struts2.StrutsConstants; diff --git a/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java b/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java index 0d77695ba4..77ecf2c05b 100644 --- a/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java +++ b/core/src/main/java/org/apache/struts2/config/impl/DefaultConfiguration.java @@ -19,11 +19,11 @@ package org.apache.struts2.config.impl; import org.apache.struts2.ActionContext; -import org.apache.struts2.DefaultLocaleProviderFactory; +import org.apache.struts2.locale.DefaultLocaleProviderFactory; import org.apache.struts2.text.DefaultTextProvider; import org.apache.struts2.FileManager; import org.apache.struts2.FileManagerFactory; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.LocalizedTextProvider; import org.apache.struts2.ObjectFactory; import org.apache.struts2.text.StrutsTextProviderFactory; diff --git a/core/src/main/java/org/apache/struts2/conversion/impl/DefaultTypeConverter.java b/core/src/main/java/org/apache/struts2/conversion/impl/DefaultTypeConverter.java index a6ebef0a2e..66ff2f4796 100644 --- a/core/src/main/java/org/apache/struts2/conversion/impl/DefaultTypeConverter.java +++ b/core/src/main/java/org/apache/struts2/conversion/impl/DefaultTypeConverter.java @@ -19,7 +19,7 @@ package org.apache.struts2.conversion.impl; import org.apache.struts2.ActionContext; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.conversion.TypeConverter; import org.apache.struts2.inject.Container; import org.apache.struts2.inject.Inject; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index 718aec72ad..deab70ce11 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -34,7 +34,7 @@ import org.apache.struts2.ActionProxyFactory; import org.apache.struts2.FileManager; import org.apache.struts2.FileManagerFactory; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.ObjectFactory; import org.apache.struts2.ServletActionContext; import org.apache.struts2.StrutsConstants; diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java index 6f5afe3490..86151a3ec3 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java @@ -18,7 +18,7 @@ */ package org.apache.struts2.dispatcher.multipart; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.struts2.dispatcher.LocalizedMessage; diff --git a/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java index 9bad6896cc..c0a1bd9d83 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java @@ -18,8 +18,8 @@ */ package org.apache.struts2.interceptor; -import org.apache.struts2.LocaleProvider; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProvider; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.TextProvider; import org.apache.struts2.text.TextProviderFactory; import org.apache.struts2.inject.Container; diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java index 63f0d9b460..d0837a95bf 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java @@ -19,10 +19,9 @@ package org.apache.struts2.interceptor; import org.apache.struts2.ActionInvocation; -import org.apache.struts2.LocaleProvider; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProvider; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.inject.Inject; -import org.apache.struts2.interceptor.AbstractInterceptor; import org.apache.struts2.util.TextParseUtil; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/core/src/main/java/org/apache/struts2/DefaultLocaleProvider.java b/core/src/main/java/org/apache/struts2/locale/DefaultLocaleProvider.java similarity index 96% rename from core/src/main/java/org/apache/struts2/DefaultLocaleProvider.java rename to core/src/main/java/org/apache/struts2/locale/DefaultLocaleProvider.java index 4e6f8b9fd7..2cf266fea1 100644 --- a/core/src/main/java/org/apache/struts2/DefaultLocaleProvider.java +++ b/core/src/main/java/org/apache/struts2/locale/DefaultLocaleProvider.java @@ -16,13 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.struts2; +package org.apache.struts2.locale; import org.apache.commons.lang3.LocaleUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; +import org.apache.struts2.ActionContext; import java.util.Locale; diff --git a/core/src/main/java/org/apache/struts2/DefaultLocaleProviderFactory.java b/core/src/main/java/org/apache/struts2/locale/DefaultLocaleProviderFactory.java similarity index 96% rename from core/src/main/java/org/apache/struts2/DefaultLocaleProviderFactory.java rename to core/src/main/java/org/apache/struts2/locale/DefaultLocaleProviderFactory.java index b5f0e5271e..160001c84d 100644 --- a/core/src/main/java/org/apache/struts2/DefaultLocaleProviderFactory.java +++ b/core/src/main/java/org/apache/struts2/locale/DefaultLocaleProviderFactory.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.struts2; +package org.apache.struts2.locale; public class DefaultLocaleProviderFactory implements LocaleProviderFactory { diff --git a/core/src/main/java/org/apache/struts2/LocaleProvider.java b/core/src/main/java/org/apache/struts2/locale/LocaleProvider.java similarity index 96% rename from core/src/main/java/org/apache/struts2/LocaleProvider.java rename to core/src/main/java/org/apache/struts2/locale/LocaleProvider.java index 6536b62a31..de27c830b8 100644 --- a/core/src/main/java/org/apache/struts2/LocaleProvider.java +++ b/core/src/main/java/org/apache/struts2/locale/LocaleProvider.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.struts2; +package org.apache.struts2.locale; import org.apache.commons.lang3.LocaleUtils; import org.apache.commons.lang3.StringUtils; @@ -25,22 +25,18 @@ /** * Indicates that the implementing class can provide its own {@link Locale}. - * *

    * This is useful for when an action may wish override the default locale. All that is * needed is to implement this interface and return your own custom locale. * The {@link org.apache.struts2.text.TextProvider} interface uses this interface * heavily for retrieving internationalized messages from resource bundles. - *

    - * - * @author Jason Carreira */ public interface LocaleProvider { /** * Gets the provided locale. * - * @return the locale. + * @return the locale. */ Locale getLocale(); @@ -62,6 +58,7 @@ public interface LocaleProvider { /** * Tries to convert provided locale string into {@link Locale} or returns null + * * @param localeStr a String representing locale, e.g.: en_EN * @return instance of {@link Locale} or null * @since Struts 6.5.0 diff --git a/core/src/main/java/org/apache/struts2/LocaleProviderFactory.java b/core/src/main/java/org/apache/struts2/locale/LocaleProviderFactory.java similarity index 94% rename from core/src/main/java/org/apache/struts2/LocaleProviderFactory.java rename to core/src/main/java/org/apache/struts2/locale/LocaleProviderFactory.java index a2881c36d7..39704fdfee 100644 --- a/core/src/main/java/org/apache/struts2/LocaleProviderFactory.java +++ b/core/src/main/java/org/apache/struts2/locale/LocaleProviderFactory.java @@ -16,7 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.struts2; +package org.apache.struts2.locale; + +import org.apache.struts2.ActionSupport; /** * Allows delegate creation of {@link LocaleProvider} to another implementation provided diff --git a/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java b/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java index a0385fd6e9..fe7ab01d68 100644 --- a/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java +++ b/core/src/main/java/org/apache/struts2/text/ResourceBundleTextProvider.java @@ -18,7 +18,7 @@ */ package org.apache.struts2.text; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import java.util.ResourceBundle; diff --git a/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java b/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java index 4f7331263d..9fb04fd73c 100644 --- a/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java +++ b/core/src/main/java/org/apache/struts2/text/StrutsTextProviderFactory.java @@ -18,7 +18,7 @@ */ package org.apache.struts2.text; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.inject.Inject; import java.util.ResourceBundle; diff --git a/core/src/main/java/org/apache/struts2/text/TextProvider.java b/core/src/main/java/org/apache/struts2/text/TextProvider.java index bdd2f026c3..65c75d23f5 100644 --- a/core/src/main/java/org/apache/struts2/text/TextProvider.java +++ b/core/src/main/java/org/apache/struts2/text/TextProvider.java @@ -18,6 +18,7 @@ */ package org.apache.struts2.text; +import org.apache.struts2.locale.LocaleProvider; import org.apache.struts2.util.ValueStack; import java.util.List; @@ -33,9 +34,9 @@ * global texts to be defined for an application base class. * *

    - * You can override {@link org.apache.struts2.LocaleProvider#getLocale()} to change the behaviour of how + * You can override {@link LocaleProvider#getLocale()} to change the behaviour of how * to choose locale for the bundles that are returned. Typically you would - * use the {@link org.apache.struts2.LocaleProvider} interface to get the users configured locale. + * use the {@link LocaleProvider} interface to get the users configured locale. *

    * *

    @@ -56,7 +57,7 @@ *

    * @author Jason Carreira * @author Rainer Hermanns - * @see org.apache.struts2.LocaleProvider + * @see LocaleProvider * @see TextProviderSupport */ public interface TextProvider { diff --git a/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java b/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java index bf2fa685a2..85638cbe4d 100644 --- a/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java +++ b/core/src/main/java/org/apache/struts2/text/TextProviderSupport.java @@ -18,8 +18,8 @@ */ package org.apache.struts2.text; -import org.apache.struts2.LocaleProvider; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProvider; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.inject.Inject; import org.apache.struts2.util.ValueStack; diff --git a/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java b/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java index 255369745a..95ed44607f 100644 --- a/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java +++ b/core/src/main/java/org/apache/struts2/validator/DelegatingValidatorContext.java @@ -22,8 +22,8 @@ import org.apache.logging.log4j.Logger; import org.apache.struts2.ActionContext; import org.apache.struts2.text.CompositeTextProvider; -import org.apache.struts2.LocaleProvider; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProvider; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.text.TextProvider; import org.apache.struts2.text.TextProviderFactory; import org.apache.struts2.interceptor.ValidationAware; diff --git a/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java b/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java index 8460ae031d..74a003575f 100644 --- a/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java +++ b/core/src/main/java/org/apache/struts2/validator/ValidatorContext.java @@ -18,7 +18,7 @@ */ package org.apache.struts2.validator; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import org.apache.struts2.text.TextProvider; import org.apache.struts2.interceptor.ValidationAware; diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java index aa81626966..57e3c2c590 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java @@ -20,7 +20,7 @@ import org.apache.struts2.ActionContext; import org.apache.struts2.ActionInvocation; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import org.apache.struts2.inject.Inject; import org.apache.struts2.util.ValueStack; import freemarker.template.Configuration; diff --git a/core/src/main/resources/struts-beans.xml b/core/src/main/resources/struts-beans.xml index 6b266f0f8e..3cbe124666 100644 --- a/core/src/main/resources/struts-beans.xml +++ b/core/src/main/resources/struts-beans.xml @@ -137,8 +137,8 @@ scope="singleton"/> - + diff --git a/core/src/test/java/org/apache/struts2/LocaleProviderTest.java b/core/src/test/java/org/apache/struts2/LocaleProviderTest.java index 7d0b79242d..2d7e579e41 100644 --- a/core/src/test/java/org/apache/struts2/LocaleProviderTest.java +++ b/core/src/test/java/org/apache/struts2/LocaleProviderTest.java @@ -18,6 +18,7 @@ */ package org.apache.struts2; +import org.apache.struts2.locale.LocaleProvider; import org.junit.Test; import java.util.Locale; diff --git a/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java b/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java index cd01de13f7..b5db3bb4c8 100644 --- a/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java +++ b/core/src/test/java/org/apache/struts2/config/providers/ConfigurationProviderOgnlAllowlistTest.java @@ -46,7 +46,7 @@ public void allowList() throws Exception { assertThat(providerAllowlist.getProviderAllowlist()).containsExactlyInAnyOrder( Class.forName("org.apache.struts2.interceptor.ValidationAware"), - Class.forName("org.apache.struts2.LocaleProvider"), + Class.forName("org.apache.struts2.locale.LocaleProvider"), Class.forName("java.io.Serializable"), Class.forName("org.apache.struts2.mock.MockResult"), Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"), @@ -72,7 +72,7 @@ public void allowlist_1only() throws Exception { assertThat(providerAllowlist.getProviderAllowlist()).containsExactlyInAnyOrder( Class.forName("org.apache.struts2.interceptor.ValidationAware"), - Class.forName("org.apache.struts2.LocaleProvider"), + Class.forName("org.apache.struts2.locale.LocaleProvider"), Class.forName("java.io.Serializable"), Class.forName("org.apache.struts2.mock.MockResult"), Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"), @@ -96,7 +96,7 @@ public void allowlist_2only() throws Exception { assertThat(providerAllowlist.getProviderAllowlist()).containsExactlyInAnyOrder( Class.forName("org.apache.struts2.interceptor.ValidationAware"), - Class.forName("org.apache.struts2.LocaleProvider"), + Class.forName("org.apache.struts2.locale.LocaleProvider"), Class.forName("java.io.Serializable"), Class.forName("org.apache.struts2.interceptor.ConditionalInterceptor"), Class.forName("org.apache.struts2.ActionSupport"), diff --git a/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java index 7dfb0e201c..93e52ab11e 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/ActionFileUploadInterceptorTest.java @@ -20,7 +20,7 @@ import org.apache.struts2.ActionContext; import org.apache.struts2.ActionSupport; -import org.apache.struts2.DefaultLocaleProvider; +import org.apache.struts2.locale.DefaultLocaleProvider; import org.apache.struts2.ValidationAwareSupport; import org.apache.struts2.mock.MockActionInvocation; import org.apache.struts2.mock.MockActionProxy; diff --git a/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java index de85a42a6f..2617d9f61f 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/I18nInterceptorTest.java @@ -21,7 +21,7 @@ import org.apache.struts2.action.Action; import org.apache.struts2.ActionContext; import org.apache.struts2.ActionInvocation; -import org.apache.struts2.DefaultLocaleProviderFactory; +import org.apache.struts2.locale.DefaultLocaleProviderFactory; import org.apache.struts2.mock.MockActionInvocation; import org.apache.struts2.mock.MockActionProxy; import junit.framework.TestCase; diff --git a/core/src/test/java/org/apache/struts2/DefaultLocaleProviderTest.java b/core/src/test/java/org/apache/struts2/locale/DefaultLocaleProviderTest.java similarity index 98% rename from core/src/test/java/org/apache/struts2/DefaultLocaleProviderTest.java rename to core/src/test/java/org/apache/struts2/locale/DefaultLocaleProviderTest.java index e87ad000bb..b58211fec0 100644 --- a/core/src/test/java/org/apache/struts2/DefaultLocaleProviderTest.java +++ b/core/src/test/java/org/apache/struts2/locale/DefaultLocaleProviderTest.java @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.struts2; +package org.apache.struts2.locale; +import org.apache.struts2.ActionContext; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; diff --git a/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java b/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java index 612c5165f1..b07f265b63 100644 --- a/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java +++ b/core/src/test/java/org/apache/struts2/text/TextProviderSupportTest.java @@ -18,7 +18,7 @@ */ package org.apache.struts2.text; -import org.apache.struts2.LocaleProvider; +import org.apache.struts2.locale.LocaleProvider; import org.apache.struts2.XWorkTestCase; import java.util.ArrayList; diff --git a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesLocaleResolver.java b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesLocaleResolver.java index e7eea43f4d..2100d8cd2d 100644 --- a/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesLocaleResolver.java +++ b/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesLocaleResolver.java @@ -19,7 +19,7 @@ package org.apache.struts2.tiles; import org.apache.struts2.ActionContext; -import org.apache.struts2.LocaleProviderFactory; +import org.apache.struts2.locale.LocaleProviderFactory; import org.apache.struts2.config.ConfigurationException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;