[
https://issues.apache.org/jira/browse/WW-3717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart resolved WW-3717.
-------------------------------
Resolution: Fixed
> Allow restricting an action to HTTP methods via an http-method attribute in
> struts.xml
> --------------------------------------------------------------------------------------
>
> Key: WW-3717
> URL: https://issues.apache.org/jira/browse/WW-3717
> Project: Struts 2
> Issue Type: New Feature
> Components: Dispatch Filter, XML Configuration
> Environment: All
> Reporter: Jeremy Norman
> Priority: Major
> Labels: restful
> Fix For: 7.5.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> Allow an action declared in {{struts.xml}} to restrict which HTTP methods it
> accepts, using a new optional {{http-method}} attribute in the 7.5 DTD. This
> is the XML counterpart of the existing {{@HttpGet}} / {{@HttpPost}} /
> {{@AllowedHttpMethod}} annotations.
> {code:xml}<action name="action1" class="org.example.ListAction"
> http-method="get"> ...
> <action name="action2" class="org.example.SaveAction" http-method="post"> ...
> <action name="action3" class="org.example.FormAction" http-method="get,post">
> ...
> {code}
> A request using a method that is not listed is rejected by
> {{HttpMethodInterceptor}} with its configured bad-request result, the same
> way as for the annotations.
> Scope:
> * one action name maps to one action config; declaring the same action name
> twice with different methods is *not* supported here
> * enforced by {{HttpMethodInterceptor}}, which reads the action config in
> addition to the annotations; when both are present the request must satisfy
> both
> * the attribute is carried over to actions resolved from wildcard / regex
> patterns
> * an invalid method name fails configuration loading
> Routing the same action name to different action configs depending on the
> HTTP method is tracked in WW-5785 (8.0.0).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)