This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5640-webjars-support in repository https://gitbox.apache.org/repos/asf/struts.git
commit 38bfd104be9d5bf9c6872a351922b8c17141f360 Author: Lukasz Lenart <[email protected]> AuthorDate: Wed Jul 1 11:11:17 2026 +0200 WW-5640 feat: add webjars config constants and defaults Co-Authored-By: Claude Opus 4.8 <[email protected]> --- .../src/main/java/org/apache/struts2/StrutsConstants.java | 15 +++++++++++++++ .../main/resources/org/apache/struts2/default.properties | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/core/src/main/java/org/apache/struts2/StrutsConstants.java b/core/src/main/java/org/apache/struts2/StrutsConstants.java index 0e9ca4fc3..e76fac4e5 100644 --- a/core/src/main/java/org/apache/struts2/StrutsConstants.java +++ b/core/src/main/java/org/apache/struts2/StrutsConstants.java @@ -195,6 +195,16 @@ public final class StrutsConstants { */ public static final String STRUTS_UI_STATIC_CONTENT_PATH = "struts.ui.staticContentPath"; + /** + * Whether WebJars support is enabled (serving and URL building) + */ + public static final String STRUTS_WEBJARS_ENABLED = "struts.webjars.enabled"; + + /** + * Optional comma-separated allowlist of WebJar names permitted to be served (empty = all) + */ + public static final String STRUTS_WEBJARS_ALLOWLIST = "struts.webjars.allowlist"; + /** * A global flag to enable/disable html body escaping in tags, can be overwritten per tag */ @@ -434,6 +444,11 @@ public final class StrutsConstants { */ public static final String STRUTS_STATIC_CONTENT_LOADER = "struts.staticContentLoader"; + /** + * The {@link org.apache.struts2.webjars.WebJarUrlProvider} implementation class + */ + public static final String STRUTS_WEBJARS_URL_PROVIDER = "struts.webjars.urlProvider"; + /** * The {@link org.apache.struts2.UnknownHandlerManager} implementation class */ diff --git a/core/src/main/resources/org/apache/struts2/default.properties b/core/src/main/resources/org/apache/struts2/default.properties index e034f2835..1c501cb33 100644 --- a/core/src/main/resources/org/apache/struts2/default.properties +++ b/core/src/main/resources/org/apache/struts2/default.properties @@ -106,6 +106,12 @@ struts.ui.staticContentPath=/static ### headers) struts.serve.static.browserCache=true +### WebJars support +### Master switch for resolving/serving WebJar assets under <staticContentPath>/webjars/** +struts.webjars.enabled=true +### Optional comma-separated allowlist of WebJar names (empty = all WebJars on the classpath) +struts.webjars.allowlist= + ### Set this to false if you wish to disable implicit dynamic method invocation ### via the URL request. This includes URLs like foo!bar.action, as well as params ### like method:bar (but not action:foo).
