Date: 2004-09-16T18:40:28 Editor: NiallPemberton <[EMAIL PROTECTED]> Wiki: Apache Struts Wiki Page: StrutsCatalogSimpleDispatchAction URL: http://wiki.apache.org/struts/StrutsCatalogSimpleDispatchAction
no comment Change Log: ------------------------------------------------------------------------------ @@ -357,8 +357,28 @@ '''Niall Pemberton''' -'''Thanks, Niall, HOWEVER ------- -This is fundametally mistaken, Niall, and rests on an important misconception. The data and the logic of !SimpleDispatchAction differ from all of !DispatchAction, !LookupDispatchAction, and !MappingDispatchAction. The error here is thinking that just because they all get the name of the method to call that anything else is just a mere difference in internal logic. That is not the case. Using one instead of the other will break the code in lots of ways, and there are huge diffences between these classes. None of the data used for the struts existing dispatch classes is used to determine the method in the !SimpleDispatchAction. For those interested in this approach, I suggest you read the exchanges on the struts-dev apache list.''' +---- -''Michael !McGrady''' +'''Thanks, Niall, HOWEVER''' +This is fundametally mistaken, Niall, and rests on an important misconception. The data and the logic of !SimpleDispatchAction differ from all of !DispatchAction, !LookupDispatchAction, and !MappingDispatchAction. The error here is thinking that just because they all get the name of the method to call that anything else is just a mere difference in internal logic. That is not the case. Using one instead of the other will break the code in lots of ways, and there are huge diffences between these classes. None of the data used for the struts existing dispatch classes is used to determine the method in the !SimpleDispatchAction. For those interested in this approach, I suggest you read the exchanges on the struts-dev apache list. + +'''Michael !McGrady''' + +---- + +On this we differ. I think the version of SimpleDispatchAction I posted does exactly the same as you're version (caveat requires slight modification to DispatchAction) but does't bloat the code base by duplicating the majority of whats already in DispatchAction. Fundamentally all these things, including SimpleDispatchAcion, do the same thing (i.e. use reflection to execute a specified method) and only differ slightly code-wise in how they determine the method name. + +On the suggestion of factoring out all this code into RequestUtils, I have the following comments: + + * All these static utility classes provide a headache because you can't override their static methods if you want to modify their behaviour. RequestUtils is just such a case - if RequestUtils was refactored to be just a facade to a bean (in the way BeanUtils has been) where you can set a custom instance to use then it would resolve this. But as it stands these kind of things are a pain - especially in this kind of case where alot of the code is the same and you just want to change small parts of the behaviour. + + * Currently DispatchAction only does the reflection to get the methods once and then caches them in a Map - moving this into RequestUtils would mean it would have to use reflection each time the method is called. + +I do like Hubert's suggestion factoring the code out of Action altogether and not having to inherit from a specific super class. I have put together a ActionDispatcher class and attached the code to a bug here: + + [http://issues.apache.org/bugzilla/show_bug.cgi?id=31270 Bug 31270] + +'''Niall Pemberton''' + +---- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
