[struts] branch master updated: TextProvider feature addition and cleanup: - Introduce (optional) control flag STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST to request TextProviders read from default resour
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/master by this push: new f62384a TextProvider feature addition and cleanup: - Introduce (optional) control flag STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST to request TextProviders read from default resource bundles first, instead of their standard lookup ordering. Defaults to false. - Minor refactor of AbstractLocalizedTextProvider hierarchy to introduce getDefaultMessageWithAlternateKey() method that repackages existing logic used by the SrutsLocalizedTextProvider and GlobalLocalizedTextProvider. - Updat [...] new e870763 Merge pull request #467 from JCgH4164838Gh792C124B5/localS2_26_TextProvider_improvement_1 f62384a is described below commit f62384a471bdf93ce53d7bf9f6e86b4287f4e23a Author: JCgH4164838Gh792C124B5 <43964333+jcgh4164838gh792c12...@users.noreply.github.com> AuthorDate: Sun Jan 3 15:33:03 2021 -0500 TextProvider feature addition and cleanup: - Introduce (optional) control flag STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST to request TextProviders read from default resource bundles first, instead of their standard lookup ordering. Defaults to false. - Minor refactor of AbstractLocalizedTextProvider hierarchy to introduce getDefaultMessageWithAlternateKey() method that repackages existing logic used by the SrutsLocalizedTextProvider and GlobalLocalizedTextProvider. - Update GlobalLocalizedTextProvider method comments to properly reflect the actual logic of some of its methods. - New unit tests to confirm standard and default bundle first lookup ordering. - Cleanup of some unused imports, a few typos, and code formatting items. - Cleanup of default.properties comments to make them more consistent. --- .../xwork2/util/AbstractLocalizedTextProvider.java | 63 ++- .../xwork2/util/GlobalLocalizedTextProvider.java | 56 ++ .../xwork2/util/StrutsLocalizedTextProvider.java | 43 +++-- .../java/org/apache/struts2/StrutsConstants.java | 11 ++ .../org/apache/struts2/default.properties | 24 +-- .../util/StrutsLocalizedTextProviderTest.java | 190 + .../com/opensymphony/xwork2/util/Bar.properties| 2 + .../xwork2/util/LocalizedTextUtilTest.properties | 1 + 8 files changed, 313 insertions(+), 77 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java b/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java index 6ed6202..d197d05 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/AbstractLocalizedTextProvider.java @@ -61,6 +61,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider { protected final ConcurrentMap bundlesMap = new ConcurrentHashMap<>(); protected boolean devMode = false; protected boolean reloadBundles = false; +protected boolean searchDefaultBundlesFirst = false; // Search default resource bundles first. Note: This flag may not be meaningful to all implementations. private final ConcurrentMap messageFormats = new ConcurrentHashMap<>(); private final ConcurrentMap> classLoaderMap = new ConcurrentHashMap<>(); @@ -68,7 +69,7 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider { private final ConcurrentMap delegatedClassLoaderMap = new ConcurrentHashMap<>(); /** - * Add's the bundle to the internal list of default bundles. + * Adds the bundle to the internal list of default bundles. * If the bundle already exists in the list it will be re-added. * * @param resourceBundleName the name of the bundle to add. @@ -431,6 +432,20 @@ abstract class AbstractLocalizedTextProvider implements LocalizedTextProvider { } /** + * Set the {@link #searchDefaultBundlesFirst} flag state. This flag may be used by descendant TextProvider + * implementations to determine if default bundles should be searched for messages first (before the standard + * flow of the {@link LocalizedTextProvider} implementation the descendant provides). + * + * @param searchDefaultBundlesFirst provide {@link String} "true" or "false" to set the flag state accordingly. + * + * @since 2.6 + */ +@Inject(value = StrutsConstants.STRUTS_I18N_SEARCH_DEFAULTBUNDLES_FIRST, required = false) +public void setSearchDefaultBundlesFirst(String searchDefaultBundlesFirst) { +this.searchDefaultBundlesFirst = Boolean.parseBoolean(searchDefaultBundlesFirst); +} + +/** * Finds the given resource bundle by it's name. * * Will use Thread.currentThread().getContextClassLoader() as the classloade
[struts-site] branch master updated: Fixes missing space
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/master by this push: new 813d6ac Fixes missing space 813d6ac is described below commit 813d6ac2303f533c9fab68985b8999b3d8ccae53 Author: Lukasz Lenart AuthorDate: Wed Jan 6 17:02:38 2021 +0100 Fixes missing space --- source/builds.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/builds.md b/source/builds.md index 8225bd1..3bc3719 100644 --- a/source/builds.md +++ b/source/builds.md @@ -64,7 +64,7 @@ For more about using Maven to build Struts 2, see For more about using Maven to build Struts 1, see our [Maven wiki page.](http://wiki.apache.org/struts/StrutsMaintenanceMaven) -## NightlyBuilds +## Nightly Builds As part of our continuous integration practice, we also make available each morning the [latest stable development build.](https://nightlies.apache.org/x1/dist/struts/)
[struts] branch WW-5021-static-content-path updated: WW-5021 Adds validation of the provided static content path
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5021-static-content-path in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5021-static-content-path by this push: new f956910 WW-5021 Adds validation of the provided static content path f956910 is described below commit f956910d20bbc162b4ba9bbc8899f88df9f8917a Author: Lukasz Lenart AuthorDate: Wed Jan 6 17:03:17 2021 +0100 WW-5021 Adds validation of the provided static content path --- .../java/org/apache/struts2/components/UIBean.java | 5 +- .../struts2/config/entities/ConstantConfig.java| 5 +- .../dispatcher/DefaultStaticContentLoader.java | 24 +- .../struts2/dispatcher/StaticContentLoader.java| 38 +++ .../org/apache/struts2/components/UIBeanTest.java | 32 + .../config/entities/ConstantConfigTest.java| 32 + .../dispatcher/DefaultStaticContentLoaderTest.java | 54 -- 7 files changed, 169 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 1586a55..2bafabc 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -30,6 +30,7 @@ import org.apache.struts2.components.template.Template; import org.apache.struts2.components.template.TemplateEngine; import org.apache.struts2.components.template.TemplateEngineManager; import org.apache.struts2.components.template.TemplateRenderingContext; +import org.apache.struts2.dispatcher.StaticContentLoader; import org.apache.struts2.util.TextProviderHelper; import org.apache.struts2.views.annotations.StrutsTagAttribute; import org.apache.struts2.views.util.ContextUtil; @@ -526,8 +527,8 @@ public abstract class UIBean extends Component { } @Inject(StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH) -public void setUiStaticContentPath(String uiStaticContentPath) { -this.uiStaticContentPath = uiStaticContentPath; +public void setStaticContentPath(String uiStaticContentPath) { +this.uiStaticContentPath = StaticContentLoader.Validator.validateStaticContentPath(uiStaticContentPath); } @Inject diff --git a/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java b/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java index 2ea04fd..93ec170 100644 --- a/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java +++ b/core/src/main/java/org/apache/struts2/config/entities/ConstantConfig.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.apache.struts2.StrutsConstants; +import org.apache.struts2.dispatcher.StaticContentLoader; public class ConstantConfig { private Boolean devMode; @@ -274,7 +275,7 @@ public class ConstantConfig { map.put(StrutsConstants.STRUTS_LOCALIZED_TEXT_PROVIDER, beanConfToString(localizedTextProvider)); map.put(StrutsConstants.STRUTS_DISALLOW_PROXY_MEMBER_ACCESS, Objects.toString(disallowProxyMemberAccess, null)); map.put(StrutsConstants.STRUTS_OGNL_AUTO_GROWTH_COLLECTION_LIMIT, Objects.toString(ognlAutoGrowthCollectionLimit, null)); -map.put(StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH, Objects.toString(staticContentPath, null)); +map.put(StrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH, Objects.toString(staticContentPath, StaticContentLoader.DEFAULT_STATIC_CONTENT_PATH)); return map; } @@ -1352,6 +1353,6 @@ public class ConstantConfig { } public void setStaticContentPath(String staticContentPath) { -this.staticContentPath = staticContentPath; +this.staticContentPath = StaticContentLoader.Validator.validateStaticContentPath(staticContentPath); } } diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java index c633c1d..0ec5286 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java @@ -48,7 +48,7 @@ import java.util.StringTokenizer; * * * This class is used to serve common static content needed when using various parts of Struts, such as JavaScript - * files, CSS files, etc. It works by looking for requests to {@link #staticContentPath}/* and then mapping the value + * files, CSS files, etc. It works by looking for requests to {@link #uiStaticContentPath}/* and then mapping the value * after to common packages in Struts and, optionally, in your class path. By default, the following packages are * automatically searched: * @@ -60,7 +60,7 @@ impo
[struts-site] branch asf-site updated: Automatic Site Publish by Buildbot
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/struts-site.git The following commit(s) were added to refs/heads/asf-site by this push: new e8b5c4a Automatic Site Publish by Buildbot e8b5c4a is described below commit e8b5c4af624fea960d0dae00a664ede58ebf24bc Author: buildbot AuthorDate: Wed Jan 6 16:03:32 2021 + Automatic Site Publish by Buildbot --- output/builds.html | 4 ++-- output/core-developers/default-properties.html | 24 ++-- output/tag-developers/action-tag.html | 2 +- output/tag-developers/bean-tag.html| 2 +- output/tag-developers/date-tag.html| 2 +- output/tag-developers/iterator-tag.html| 2 +- output/tag-developers/set-tag.html | 4 ++-- output/tag-developers/text-tag.html| 2 +- output/tag-developers/url-tag.html | 2 +- 9 files changed, 24 insertions(+), 20 deletions(-) diff --git a/output/builds.html b/output/builds.html index 2695f0d..b8ef78a 100644 --- a/output/builds.html +++ b/output/builds.html @@ -133,7 +133,7 @@ Building Apache Struts - NightlyBuilds + Nightly Builds Test Builds Maven Snapshots Licensing of Apache Struts Builds @@ -190,7 +190,7 @@ your own applications!) For more about using Maven to build Struts 1, see our http://wiki.apache.org/struts/StrutsMaintenanceMaven";>Maven wiki page. -NightlyBuilds +Nightly Builds As part of our continuous integration practice, we also make available each morning the https://nightlies.apache.org/x1/dist/struts/";>latest stable development build. diff --git a/output/core-developers/default-properties.html b/output/core-developers/default-properties.html index 0b3762f..4b0d31a 100644 --- a/output/core-developers/default-properties.html +++ b/output/core-developers/default-properties.html @@ -164,7 +164,7 @@ on the classpath, but it is typically found under false String -Name used to reference the value pushed into the Value Stack +Name used to reference the value pushed into the Value Stack (scope: action). diff --git a/output/tag-developers/bean-tag.html b/output/tag-developers/bean-tag.html index c937fdf..f9a0d52 100644 --- a/output/tag-developers/bean-tag.html +++ b/output/tag-developers/bean-tag.html @@ -175,7 +175,7 @@ of param elements to set any mutator methods on that cla false String -Name used to reference the value pushed into the Value Stack +Name used to reference the value pushed into the Value Stack (scope: action). diff --git a/output/tag-developers/date-tag.html b/output/tag-developers/date-tag.html index 911583c..a204910 100644 --- a/output/tag-developers/date-tag.html +++ b/output/tag-developers/date-tag.html @@ -274,7 +274,7 @@ and the format attribute. false String -Name used to reference the value pushed into the Value Stack +Name used to reference the value pushed into the Value Stack (scope: action). diff --git a/output/tag-developers/iterator-tag.html b/output/tag-developers/iterator-tag.html index d448557..482feb8 100644 --- a/output/tag-developers/iterator-tag.html +++ b/output/tag-developers/iterator-tag.html @@ -210,7 +210,7 @@ The begin, false String -Name used to reference the value pushed into the Value Stack +Name used to reference the value pushed into the Value Stack (scope: action). diff --git a/output/tag-developers/set-tag.html b/output/tag-developers/set-tag.html index 3b508f0..5b709b2 100644 --- a/output/tag-developers/set-tag.html +++ b/output/tag-developers/set-tag.html @@ -183,7 +183,7 @@ the body evaluates is set as value for the scoped variable. action false String -The scope in which to assign the variable. Can be application, session, request, page, or action. +The scope in which to assign the variable. Can be application, session, request, page, or action (action scope also adds it to the page scope). trimBody @@ -207,7 +207,7 @@ the body evaluates is set as value for the scoped variable. false String -Name used to reference the value pushed into the Value Stack +Name used to reference the value pushed into the Value Stack (default scope: action,override with the scope attribute). diff --git a/output/tag-developers/text-tag.html b/output/tag-developers/text-tag.html index f3ddb56..5f16c5b 100644 --- a/output/tag-developers/text-tag.html +++ b/output/tag-developers/text-tag.html @@ -214,7 +214,7 @@ If no value is f
Buildbot success in on jekyll_websites
The Buildbot has detected a passing build on builder jekyll_websites while building struts. Full details are available at: https://ci2.apache.org/#builders/7/builds/329 Buildbot URL: https://ci2.apache.org/ Worker for this Build: bb_slave10_ubuntu Build Reason: Triggered jekyll auto-build via .asf.yaml by lukaszlenart Blamelist: asfinfra, commits@struts.apache.org Build succeeded! Sincerely, -The Buildbot
[struts] branch WW-5000-constants updated: WW-5000 Puts back STRUTS_LOG_MISSING_PROPERTIES and marks it deprecated
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5000-constants in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5000-constants by this push: new 18f9602 WW-5000 Puts back STRUTS_LOG_MISSING_PROPERTIES and marks it deprecated 18f9602 is described below commit 18f9602b42ed1e74a8d520dbb911dfd2476347f2 Author: Lukasz Lenart AuthorDate: Wed Jan 6 17:43:59 2021 +0100 WW-5000 Puts back STRUTS_LOG_MISSING_PROPERTIES and marks it deprecated --- core/src/main/java/org/apache/struts2/StrutsConstants.java | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java index bac1288..d1cf8fc 100644 --- a/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java @@ -249,9 +249,19 @@ public final class StrutsConstants { /** 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"; -/** Logs properties that are not found (very verbose) */ +/** + * Logs properties that are not found (very verbose) + * @since 2.6 + */ public static final String STRUTS_OGNL_LOG_MISSING_PROPERTIES = "struts.ognl.logMissingProperties"; +/** + * Logs properties that are not found (very verbose) + * @deprecated as of 2.6. Use {@link #STRUTS_OGNL_LOG_MISSING_PROPERTIES} instead. + */ +@Deprecated +public static final String STRUTS_LOG_MISSING_PROPERTIES = STRUTS_OGNL_LOG_MISSING_PROPERTIES; + /** Enables caching of parsed OGNL expressions */ public static final String STRUTS_ENABLE_OGNL_EXPRESSION_CACHE = "struts.ognl.enableExpressionCache";