This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/asf-staging by this push:
     new 8b2ea998d Updates stage by Jenkins
8b2ea998d is described below

commit 8b2ea998db203d6b6e4ed68238cb340259a2c9ca
Author: jenkins <bui...@apache.org>
AuthorDate: Tue Oct 10 13:24:12 2023 +0000

    Updates stage by Jenkins
---
 content/core-developers/static-content.html | 16 ++++++--
 content/core-developers/web-xml.html        | 61 +++++++++++++++++------------
 2 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/content/core-developers/static-content.html 
b/content/core-developers/static-content.html
index 90f98e9d5..5d674b17a 100644
--- a/content/core-developers/static-content.html
+++ b/content/core-developers/static-content.html
@@ -132,21 +132,29 @@
     <h1 class="no_toc" id="static-content">Static Content</h1>
 
 <ul id="markdown-toc">
+  <li><a href="#disabling-static-content" 
id="markdown-toc-disabling-static-content">Disabling static content</a></li>
   <li><a href="#custom-static-content-loaders" 
id="markdown-toc-custom-static-content-loaders">Custom Static Content 
Loaders</a></li>
   <li><a href="#default-content-loader" 
id="markdown-toc-default-content-loader">Default Content Loader</a></li>
   <li><a href="#default-path" id="markdown-toc-default-path">Default 
path</a></li>
   <li><a href="#preventing-struts-from-handling-a-request" 
id="markdown-toc-preventing-struts-from-handling-a-request">Preventing Struts 
from handling a request</a></li>
 </ul>
 
-<p>Struts can serve static content like css and javascript files. This feature 
is enabled by default, but can be disabled
-by setting:</p>
+<p>Struts can serve a static content like CSS and JavaScript files using a 
predefined path. By default, these resources
+are served using <code class="language-plaintext 
highlighter-rouge">/static</code> path defined using a constant <code 
class="language-plaintext highlighter-rouge">struts.ui.staticContentPath</code> 
- see below for more details.</p>
+
+<p>Please remember to include this path in your filter mapping if you use a 
custom mapping, see <a href="web-xml.md">web.xml</a> example config.</p>
+
+<h2 id="disabling-static-content">Disabling static content</h2>
+
+<p>You can disable this feature by setting the following constant to <code 
class="language-plaintext highlighter-rouge">false</code>. Once disabled you 
must provided the required
+CSS &amp; JavaScript files on your own, which can be a good thing when you 
want to use a CDN.</p>
 
 <div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;constant</span> <span 
class="na">name=</span><span class="s">"struts.serve.static"</span> <span 
class="na">value=</span><span class="s">"false"</span><span 
class="nt">/&gt;</span>
 </code></pre></div></div>
 
 <blockquote>
-  <p>If you disable this feature, but use the <code class="language-plaintext 
highlighter-rouge">xhtml</code>, or <code class="language-plaintext 
highlighter-rouge">css_xhtml</code> theme, make sure that the javascript and 
css files
-shipped inside the core jar are extracted to your web application 
directory.</p>
+  <p>If you disable this feature, but you use the <code 
class="language-plaintext highlighter-rouge">xhtml</code>, or <code 
class="language-plaintext highlighter-rouge">css_xhtml</code> theme, make sure 
the JavasScript and CSS files
+shipped inside the core jar are extracted to your web application directory or 
served in some other way.</p>
 </blockquote>
 
 <h2 id="custom-static-content-loaders">Custom Static Content Loaders</h2>
diff --git a/content/core-developers/web-xml.html 
b/content/core-developers/web-xml.html
index d4ca7fec0..bfaecdcb3 100644
--- a/content/core-developers/web-xml.html
+++ b/content/core-developers/web-xml.html
@@ -133,8 +133,7 @@
 
 <ul id="markdown-toc">
   <li><a href="#simple-example" id="markdown-toc-simple-example">Simple 
Example</a></li>
-  <li><a href="#changed-filter-package-in-struts--25" 
id="markdown-toc-changed-filter-package-in-struts--25">Changed filter package 
in Struts &gt;= 2.5</a></li>
-  <li><a href="#changed-filter-structure-in-struts--213" 
id="markdown-toc-changed-filter-structure-in-struts--213">Changed Filter 
Structure in Struts &gt;= 2.1.3</a></li>
+  <li><a href="#custom-mapping" id="markdown-toc-custom-mapping">Custom 
mapping</a></li>
   <li><a href="#exclude-specific-urls" 
id="markdown-toc-exclude-specific-urls">Exclude specific URLs</a></li>
   <li><a href="#taglib-example" id="markdown-toc-taglib-example">Taglib 
Example</a></li>
   <li><a href="#custom-filemanager-and-filemanagerfactory-implementations" 
id="markdown-toc-custom-filemanager-and-filemanagerfactory-implementations">Custom
 FileManager and FileManagerFactory implementations</a></li>
@@ -174,38 +173,50 @@ should behave.</p>
 <span class="nt">&lt;/web-app&gt;</span>
 </code></pre></div></div>
 
-<h2 id="changed-filter-package-in-struts--25">Changed filter package in Struts 
&gt;= 2.5</h2>
+<p>See <a href="../plugins/sitemesh-plugin">SiteMesh Plugin</a> for an example 
on when to use separate Filters for prepare and execution phase.</p>
 
-<p>As from Struts 2.5 all filters were moved to top package, if you are using 
older version you must use the old package, 
-see example:</p>
+<h2 id="custom-mapping">Custom mapping</h2>
 
-<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;web-app</span> <span 
class="na">id=</span><span class="s">"WebApp_9"</span> <span 
class="na">version=</span><span class="s">"2.4"</span> 
-       <span class="na">xmlns=</span><span 
class="s">"http://java.sun.com/xml/ns/j2ee";</span> 
-       <span class="na">xmlns:xsi=</span><span 
class="s">"http://www.w3.org/2001/XMLSchema-instance";</span> 
-       <span class="na">xsi:schemaLocation=</span><span 
class="s">"http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";</span><span 
class="nt">&gt;</span>
+<p>The above approach is a preferred way of enabling support for Struts in 
your web application. Yet you can have more
+specific requirements and use more specific mapping like presented below:</p>
+
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;web-app</span> <span 
class="err">...</span><span class="nt">&gt;</span>
 
     <span class="nt">&lt;filter&gt;</span>
         <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
-        <span 
class="nt">&lt;filter-class&gt;</span>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter<span
 class="nt">&lt;/filter-class&gt;</span>
+        <span 
class="nt">&lt;filter-class&gt;</span>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter<span
 class="nt">&lt;/filter-class&gt;</span>
     <span class="nt">&lt;/filter&gt;</span>
-    ...
+
+    <span class="nt">&lt;filter-mapping&gt;</span>
+        <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
+        <span class="nt">&lt;url-pattern&gt;</span>*.action<span 
class="nt">&lt;/url-pattern&gt;</span>
+    <span class="nt">&lt;/filter-mapping&gt;</span>
+
 <span class="nt">&lt;/web-app&gt;</span>
 </code></pre></div></div>
 
-<h2 id="changed-filter-structure-in-struts--213">Changed Filter Structure in 
Struts &gt;= 2.1.3</h2>
+<p>In such case only requests ending with <code class="language-plaintext 
highlighter-rouge">.action</code> will be directed by a Servlet container to be 
handled by Struts filter.
+This can impact serving static content provided by Struts and you will have to 
define additional mapping to support it:</p>
 
-<p>To split up the the dispatcher phases, FilterDispatcher is deprecated since 
Struts 2.1.3. If working with older 
-versions, you need to use</p>
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;web-app</span> <span 
class="err">...</span><span class="nt">&gt;</span>
 
-<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code>    ...
     <span class="nt">&lt;filter&gt;</span>
         <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
-        <span 
class="nt">&lt;filter-class&gt;</span>org.apache.struts2.dispatcher.FilterDispatcher<span
 class="nt">&lt;/filter-class&gt;</span>
-    ...
-</code></pre></div></div>
+        <span 
class="nt">&lt;filter-class&gt;</span>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter<span
 class="nt">&lt;/filter-class&gt;</span>
+    <span class="nt">&lt;/filter&gt;</span>
+
+    <span class="nt">&lt;filter-mapping&gt;</span>
+        <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
+        <span class="nt">&lt;url-pattern&gt;</span>*.action<span 
class="nt">&lt;/url-pattern&gt;</span>
+    <span class="nt">&lt;/filter-mapping&gt;</span>
 
-<p>See <a href="../plugins/sitemesh-plugin">SiteMesh Plugin</a> for an example 
on when to use separate Filters for prepare 
-and execution phase.</p>
+    <span class="nt">&lt;filter-mapping&gt;</span>
+        <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
+        <span class="nt">&lt;url-pattern&gt;</span>/static/*<span 
class="nt">&lt;/url-pattern&gt;</span>
+    <span class="nt">&lt;/filter-mapping&gt;</span>
+
+<span class="nt">&lt;/web-app&gt;</span>
+</code></pre></div></div>
 
 <h2 id="exclude-specific-urls">Exclude specific URLs</h2>
 
@@ -239,8 +250,8 @@ the container will discover it automatically.</p>
 <code class="language-plaintext highlighter-rouge">META-INF</code> folder, and 
add a <code class="language-plaintext highlighter-rouge">taglib</code> element 
to the <code class="language-plaintext highlighter-rouge">web.xml</code>.</p>
 </blockquote>
 
-<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code>    <span class="c">&lt;!-- ... --&gt;</span>
-    <span class="nt">&lt;/welcome-file-list&gt;</span>
+<div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;web-app</span> <span 
class="err">...</span><span class="nt">&gt;</span>
+    <span class="c">&lt;!-- ... --&gt;</span> 
 
     <span class="nt">&lt;taglib&gt;</span>
        <span class="nt">&lt;taglib-uri&gt;</span>/s<span 
class="nt">&lt;/taglib-uri&gt;</span>
@@ -282,8 +293,8 @@ version of FileManager. But it must be registered at “the 
beginning” to supp
 
 <h2 id="custom-configuration-provider">Custom configuration provider</h2>
 
-<p>It is possible to use your custom <code class="language-plaintext 
highlighter-rouge">ConfigurationProvider</code> to programmatically configure 
your application. To do this use 
-<code class="language-plaintext highlighter-rouge">configProviders</code> (it 
can be a comma-separated list of class names) <code class="language-plaintext 
highlighter-rouge">&lt;init-param/&gt;</code> as below:</p>
+<p>It is possible to use your custom <code class="language-plaintext 
highlighter-rouge">ConfigurationProvider</code> to programmatically configure 
your application. To do this use 
+<code class="language-plaintext highlighter-rouge">configProviders</code> (it 
can be a comma-separated list of class names) <code class="language-plaintext 
highlighter-rouge">&lt;init-param/&gt;</code> as below:</p>
 
 <div class="language-xml highlighter-rouge"><div class="highlight"><pre 
class="highlight"><code><span class="nt">&lt;filter&gt;</span>
      <span class="nt">&lt;filter-name&gt;</span>struts2<span 
class="nt">&lt;/filter-name&gt;</span>
@@ -295,7 +306,7 @@ version of FileManager. But it must be registered at “the 
beginning” to supp
 <span class="nt">&lt;/filter&gt;</span>
 </code></pre></div></div>
 
-<p>See <a href="configuration-provider-and-configuration">Configuration 
Provider &amp; Configuration</a> for more details.</p>
+<p>See <a href="configuration-provider-and-configuration">Configuration 
Provider &amp; Configuration</a> for more details.</p>
 
   </section>
 </article>

Reply via email to