You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Michael Jouravlev (JIRA)" <ji...@apache.org> on 2007/02/20 19:52:16 UTC

[jira] Commented: (STR-2940) Base Action should implement dispatch functionality (building a coarse-grained action)

    [ https://issues.apache.org/struts/browse/STR-2940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40219 ] 

Michael Jouravlev commented on STR-2940:
----------------------------------------

I am planning to implement dispatch functionality in Action class for version 1.4. After discussion with Paul Benedict I am considering the following approach:

* Add "events" attribute to action mapping definition [optional].
* Define events that are recognized by an action in the same manner as they are defined for EventDispatchAction in "parameter" attribute, moving this definition from "parameter" to "event".
* Free "parameter" attribute for its historic usage as auxiliary parameter.
* Add "dispatch" attribute to action mapping definition (suggested by Paul). Possible values are "event" (default), "classic" (chosen so "dispatch" won't be repeated as attr value), "mapping", "lookup". This attribute will allow to define a specific dispatching mechanism implementing features of other dispatching actions.

The control flow:

* If neither "events" nor "dispatch" attributes are not defined, the Action is handled in original way and its execute() method is called.
* If "events" attribute is specified but "dispatch" attribute is not specified, Action runs as EventDispatchAction.
* If "events" attribute is not specified but "dispatch" attribute is specified, Action runs according to dispatch flavor.
* If both "events" and "dispatch" attribute is specified, Action runs as EventDispatchAction if "dispatch" attribute has "event" value, otherwise it runs according to dispatch flavor and does not take "events" attribute into account.

> Base Action should implement dispatch functionality (building a coarse-grained action)
> --------------------------------------------------------------------------------------
>
>                 Key: STR-2940
>                 URL: https://issues.apache.org/struts/browse/STR-2940
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Michael Jouravlev
>         Assigned To: Michael Jouravlev
>            Priority: Minor
>
> Since DispatchAction was introduced, it became possible to write actions in two styles:
> * Fine-grained actions that process only one kind of request / command / event. These are standard Action classes where code is written in execute() method.
> * Coarse-grained actions that process several commands/events. These are DispatchAction, MappingDispatchAction, LookupDispatchAction and EventDispatchAction. 
> Building coarse-grained actions always has been kind of hack with either using the generic "parameter" attribute of an action mapping, or with building event-to-method maps in the code.
> The proposed enhancement has the following goals:
> * Add dispatch functionality to base Action without affecting current Action usage.
> * Accept that both fine-grained and coarse-grained approaches are valid and should be equally represented; one approach should not suffer from dominating of another.
> * Extend syntax of an action mapping to allow event defintion using designated elements instead of using hacks like generic "parameter" attribute.
> * Allow using wildcards in event definitions.
> * With a coarse-grained action it is easier to introduce a concept of a web resource that can be affected by several events, can have state and can render several views. This concept allows to draw some similarities between a Model 2 framework like Struts and code-behind framework like .NET: Action + ActionForm is a code-behind, JSP is markup, event-handling methods in an Action class are event handlers.
> Introduction of Command class in Struts 1.3.x does not affect coarse-grained actions, these actions should be implemented with an Action class.
> Action class retrofitted to support dispatch functionality will behave exactly like EventDispatchAction when used as a coarce-grained action.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.