Lukasz Lenart created WW-5640:
---------------------------------

             Summary: Add WebJars support to Struts core
                 Key: WW-5640
                 URL: https://issues.apache.org/jira/browse/WW-5640
             Project: Struts 2
          Issue Type: New Feature
          Components: Core
            Reporter: Lukasz Lenart
             Fix For: 7.3.0


Add first-class WebJars support to Struts core so client-side libraries 
packaged as WebJars (shipped under 
{{META-INF/resources/webjars/<name>/<version>/…}}) can be referenced by a 
version-less logical path and served through Struts' existing static-content 
pipeline.

Example: a template references bootstrap/css/bootstrap.min.css; Struts resolves 
and serves {{META-INF/resources/webjars/bootstrap/5.3.8/css/bootstrap.min.css}}.

Today plugins and apps vendor client-side assets directly on the classpath and 
re-commit them on every upgrade (the struts2-bootstrap plugin commits ~2000 
files by hand each release). WebJars replace this with a dependency bump 
(auto-updatable via Renovate/Dependabot).

Scope (core only):
- Add org.webjars:webjars-locator-lite (MIT; one Apache-2.0 transitive dep) for 
version resolution.
- New WebJarUrlProvider container bean — the public, injectable seam for 
plugins.
- Serve <staticContentPath>/webjars/** via a branch in 
DefaultStaticContentLoader, reusing existing caching; extend content-type 
coverage for fonts/svg/source-maps.
- Thin <s:webjar> tag + <@s.webjar> macro emitting the resolved URL string.
- New config: struts.webjars.enabled (default true), struts.webjars.allowlist 
(optional).
- Security: constrain resolution to the webjars root, block .. traversal, fail 
closed (404 / no URL) on unresolved paths.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to