Is there a way to configure whether a struts action can be invoked?
For example, I have the following class:
public class MyAction {
public String myMethod() {
// logic
}
}
and the struts.xml
file:
<action class="MyAction" method="myMethod"/>
Can I add in this file a configuration that let's me disable the invocation of this action like for example:
<action class="MyAction" method="myMethod">
<param name="disable">true</param>
</action>
A use case of this may be when I want to disable the execution of an action in dev mode, i.e I have an action that I invoke it from the client using AJAX. The invocation of the action ensures an important feature of my app. This feature is mandatory for the app to work properly. However, this feature may be a burden in dev mode, thus disabling it (only in this mode) will be so useful.
One approach to resolve this is by using the interceptor mechanism (as suggested in the comments). However, can this be done at the config level?