Lukasz Lenart created WW-5785:
---------------------------------

             Summary: Route the same action name to different action configs 
based on the HTTP method
                 Key: WW-5785
                 URL: https://issues.apache.org/jira/browse/WW-5785
             Project: Struts 2
          Issue Type: New Feature
          Components: Dispatch Filter, XML Configuration
            Reporter: Lukasz Lenart
             Fix For: 8.0.0


Follow-up to WW-3717, which adds an {{http-method}} attribute that restricts a 
single action to a set of HTTP methods. This ticket covers declaring the *same* 
action name more than once, each with a different {{http-method}}, and 
dispatching to the matching config:

{code:xml}<action name="action1" class="org.example.ListAction" method="index" 
http-method="get"> ...
<action name="action1" class="org.example.EditAction" method="create" 
http-method="post"> ...
{code}

This is useful together with the regex pattern matcher for REST-style URLs 
without the REST plugin, e.g. {{/{entity}/{id}}} with GET and POST going to 
different action classes.

Points to design:
* action configs are keyed by namespace + name today ({{PackageConfig}}, 
{{RuntimeConfiguration.getActionConfigs()}}); a second declaration with the 
same name replaces the first, so the key has to include the method, and the 
public lookup API changes
* wildcard / regex matching has to select by method as well as by pattern
* lookups made without a request ({{Form}}, {{ServletUrlRenderer}}, 
{{ConventionUnknownHandler}}, config-browser) need a rule for which config they 
resolve
* behaviour for a method that matches none of the declarations (405 vs falling 
back to a declaration without {{http-method}})
* two declarations with the same name and an overlapping method should fail 
configuration loading
* dispatch must use the real request method, not a request-parameter override



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to