You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/05/05 13:12:32 UTC

svn commit: r987524 - /websites/production/struts/content/docs/action-configuration.html

Author: lukaszlenart
Date: Thu May  5 13:12:32 2016
New Revision: 987524

Log:
Updates production

Modified:
    websites/production/struts/content/docs/action-configuration.html

Modified: websites/production/struts/content/docs/action-configuration.html
==============================================================================
--- websites/production/struts/content/docs/action-configuration.html (original)
+++ websites/production/struts/content/docs/action-configuration.html Thu May  5 13:12:32 2016
@@ -139,11 +139,11 @@ under the License.
     <div class="pagecontent">
         <div class="wiki-content">
             <div id="ConfluenceContent"><p>The action mappings are the basic "unit-of-work" in the framework. Essentially, the action maps an identifier to a handler class. When a request matches the action's name, the framework uses the mapping to determine how to process the request.</p><p><style type="text/css">/*<![CDATA[*/
-div.rbtoc1453884195503 {padding: 0px;}
-div.rbtoc1453884195503 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1453884195503 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1462453925234 {padding: 0px;}
+div.rbtoc1462453925234 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1462453925234 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1453884195503">
+/*]]>*/</style></p><div class="toc-macro rbtoc1462453925234">
 <ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-ActionMappings">Action Mappings</a></li><li><a shape="rect" href="#ActionConfiguration-ActionNames">Action Names</a></li><li><a shape="rect" href="#ActionConfiguration-ActionMethods">Action Methods</a></li><li><a shape="rect" href="#ActionConfiguration-WildcardMethod">Wildcard Method</a></li><li><a shape="rect" href="#ActionConfiguration-DynamicMethodInvocation">Dynamic Method Invocation</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#ActionConfiguration-StrictDMI">Strict DMI</a></li><li><a shape="rect" href="#ActionConfiguration-StrictMethodInvocation">Strict Method Invocation</a></li></ul>
 </li><li><a shape="rect" href="#ActionConfiguration-ActionSupportDefault">ActionSupport Default</a></li><li><a shape="rect" href="#ActionConfiguration-Post-BackDefault">Post-Back Default</a></li><li><a shape="rect" href="#ActionConfiguration-ActionDefault">Action Default</a>
@@ -216,7 +216,7 @@ public class CrudAction {
   &lt;/package&gt;
 &lt;/struts&gt;
 </pre>
-</div></div><h3 id="ActionConfiguration-StrictMethodInvocation">Strict Method Invocation</h3><p>In Struts 2.5 the Strict DMI was extended and it's called "Strict Method Invocation" aka SMI. You can imagine that the DMI is a "border police", where SMI is a "tax police" and keeps eye on internals. With this version SMI is enabled by default (<code>strict-method-invocation</code> attribute is set to&#160;<code>true</code> by default in&#160;<code>struts-default</code> package), you have option to disable it per package - there is no global switch to disable SMI for the whole application. To gain advantage of new configuration option please use the latest DTD definition:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2.5 DTD</b></div><div class="codeContent panelContent pdl">
+</div></div><h3 id="ActionConfiguration-StrictMethodInvocation">Strict Method Invocation</h3><p>In Struts 2.5 the Strict DMI was extended and it's called <strong>Strict Method Invocation</strong>&#160;aka SMI. You can imagine that the DMI is a "border police", where SMI is a "tax police" and keeps eye on internals. With this version, SMI is enabled by default (<code>strict-method-invocation</code> attribute is set to&#160;<code>true</code> by default in&#160;<code>struts-default</code> package), you have option to disable it per package - there is no global switch to disable SMI for the whole application. To gain advantage of new configuration option please use the latest DTD definition:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Struts 2.5 DTD</b></div><div class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
 &lt;!DOCTYPE struts PUBLIC
         "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
@@ -224,7 +224,7 @@ public class CrudAction {
 &lt;struts&gt;
 ...
 &lt;/struts&gt;</pre>
-</div></div><p>SMI works in the following way:</p><ul style="list-style-type: square;"><li><code>&lt;allowed-methods&gt;</code>&#160;/ <code>@AllowedMethods</code>&#160;is defined per action - SMI works without switching it on but just for those actions (plus adding <code>&lt;global-allowed-methods/&gt;</code>)</li><li>SMI is enabled but no <code>&lt;allowed-methods&gt;</code>&#160;/ <code>@AllowedMethods</code>&#160;are defined - SMI works but only with <code>&lt;global-allowed-methods/&gt;</code></li><li><span style="line-height: 1.42857;">SMI is disabled - call to any action method is allowed (&#160;<code>Regex: .*</code>&#160;)</span></li></ul><p><span style="line-height: 1.42857;">You can configure SMI per <code>&lt;action/&gt;</code> usinf&#160;<code>&lt;allowed-methods/&gt;</code> tag or via&#160;<code>@AllowedMethod</code> annotation plus using per&#160;<code>&lt;package/&gt;</code>&#160;<code>&lt;global-allowed-methods/&gt;</code>, see the examples below:</span></p><div cla
 ss="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SMI via struts.xml</b></div><div class="codeContent panelContent pdl">
+</div></div><p>SMI works in the following way:</p><ul style="list-style-type: square;"><li><code>&lt;allowed-methods&gt;</code>&#160;/ <code>@AllowedMethods</code>&#160;is defined per action - SMI works without switching it on but just for those actions (plus adding <code>&lt;global-allowed-methods/&gt;</code>)</li><li>SMI is enabled but no <code>&lt;allowed-methods&gt;</code>&#160;/ <code>@AllowedMethods</code>&#160;are defined - SMI works but only with <code>&lt;global-allowed-methods/&gt;</code></li><li><span style="line-height: 1.42857;">SMI is disabled - call to any action method is allowed that matches the default RegEx -&#160;<code>([A-Za-z0-9_$]*)</code></span></li></ul><p>You can redefine the default RegEx by using a constant as follow&#160;<code>&lt;constant name="struts.strictMethodInvocation.methodRegex" value="([a-zA-Z]*)"/&gt;</code></p><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning 
 confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When using wildcard mapping in actions' definitions SMI works in two ways:</p><ul style="list-style-type: square;"><li>SMI is disabled - any wildcard will be substituted with the default RegEx, ie.: <code>&lt;action name="Person*" method="perform*"&gt;</code> will be translated into <code>allowedMethod = "regex:perform([A-Za-z0-9_$]*)".</code></li><li>SMI is enabled - no wildcard substitution will happen, you must strictly define which methods can be accessed by annotations or <code>&lt;allowed-method/&gt;</code> tag.</li></ul></div></div><p><span style="line-height: 1.42857;">You can configure SMI per <code>&lt;action/&gt;</code> using&#160;<code>&lt;allowed-methods/&gt;</code> tag or via&#160;<code>@AllowedMethod</code> annotation plus using per&#160;<code>&lt;package/&gt;</code>&#160;<code>&lt;global-allowed-methods/&gt;</code>, see the examples below:</span></p><div class="code panel pdl"
  style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SMI via struts.xml</b></div><div class="codeContent panelContent pdl">
 <pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;package ...&gt;
   ...
   &lt;global-allowed-methods&gt;execute,input,back,cancel,browse&lt;/global-allowed-methods&gt;