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 1301ebb WW-5021 Adds a note about how to use struts.ui.staticContentPath 1301ebb is described below commit 1301ebb6d38b06b5c3a0054061f0b73628bde84d Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Sun Dec 12 17:32:26 2021 +0100 WW-5021 Adds a note about how to use struts.ui.staticContentPath --- source/core-developers/static-content.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/core-developers/static-content.md b/source/core-developers/static-content.md index ee60e60..4525480 100644 --- a/source/core-developers/static-content.md +++ b/source/core-developers/static-content.md @@ -28,7 +28,7 @@ Static content is served by an implementation of `org.apache.struts2.dispatcher. ## Default Content Loader Struts provides a default implementation of `StaticContentLoader` which is `org.apache.struts2.dispatcher.DefaultStaticContentLoader`. -This loader will handle urls that start with "/static/". +This loader will handle urls that start with "/static/" by default. This content loader can serve static content from the classpath, so when writing a plugin, you can put a file inside your plugin's jar like "/static/image/banner.jpg" and it will be served when the url "/static/image/banner.jpg" is @@ -37,6 +37,17 @@ requested. > This loader is not optimized to handle static content, and to improve > performance, it is recommended that you extract > your static content to the web application directory, and let the container > handle them. +## Default path + +If needed you can change the default path at which static content is served. Just define a new `constant` in your +`struts.xml` with a path as below: + +```xml +<constant name="struts.ui.staticContentPath" value="/my-static-content"/> +``` + +This value is also used by the Default Content Loader. + ## Preventing Struts from Handling a Request If there is a request that Struts is handling as an action, and you wish to make Struts ignore it, you can do so by specifying