Let's assume you're starting from the AuthenticatedAction class I suggested. Then you would have something like this:
public class DoSomethingUsefulAction extends AuthenticatedAction { protected ActionForward executeAuthenticated(...) { // The code you would otherwise have put in // execute() or perform() goes here. } } There's no need to call any 'super' methods - the base class methods get control before your executeAuthenticated does (because AuthenticatedAction implements execute()), and they call you. In your struts-config.xml file, you would refer only to DoSomethingUsefulAction. The AuthenticatedAction would be referenced only in your actions which extend it. If you're into design patterns, this is just a simple example of Template Method (as is Action itself). -- Martin Cooper > -----Original Message----- > From: Jerry Jalenak [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 24, 2002 6:41 AM > To: '[EMAIL PROTECTED]' > Subject: RE: Migration from 1.0.2 to 1.1 > > > Martin, > > Sorry to bother you directly like this, but I've been trying > to subclass > Action similar to the manner you have outlined below. I've created my > abstract 'super' class that extends Action, coded my common > routines, etc. > It does not appear that my 'super' class gets called when my > sub-classed > action is invoked. I assume that the struts-config would > still point to the > sub-classed action, and the first thing the sub-classed > action should do is > a 'super();' type of call. Is this right? Or am I totally missing > something? > > Thanks for your help! > > Jerry Jalenak > Development Manager, Web Publishing > LabOne, Inc. > > > -----Original Message----- > > From: Martin Cooper [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 10, 2002 5:41 PM > > To: 'Struts Users Mailing List' > > Subject: RE: Migration from 1.0.2 to 1.1 > > > > > > The first time I did that, I did it the same way you did. > > However, what I do > > now is use a base class for all my actions that does the > > authentication > > check before calling my perform/execute-equivalent method to > > do the real > > work. It looks something like this: > > > > public abstract class AuthenticatedAction extends Action { > > public ActionForward execute(...) { > > if (!authenticated(...)) { > > return mapping.findForward("authError"); > > } > > return executeAuthenticated(...); > > } > > protected abstract ActionForward executeAuthenticated(...); > > protected boolean authenticated(...) { > > // Do whatever kind of auth check you need here > > } > > } > > > > I've left out the details of parameters, exceptions, etc., > > but hopefully you > > get the idea. Now my worker actions extend > > AuthenticatedAction and implement > > executeAuthenticated(). > > > > Changing over from the old code to the new was very simple, > because it > > involved only changing the base class of my worker actions > > and the name of > > the method they implement. Also, if you ever need actions > > that don't care > > about authentication, you can simply have them extend Action > > instead of > > AuthenticatedAction. (That's much harder to do using the > > scheme you are > > using, and I was using before.) > > > > -- > > Martin Cooper > > > > > > > -----Original Message----- > > > From: Struts Newsgroup [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, July 10, 2002 2:55 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: Migration from 1.0.2 to 1.1 > > > > > > > > > Subject: Re: Migration from 1.0.2 to 1.1 > > > From: "Heritier Arnaud" <[EMAIL PROTECTED]> > > > === > > > Thx for your help Martin. > > > > > > In struts 1.0.2 I subclassed the ActionServlet to define a > > > processPreprocess > > > method which verify the user authentification. > > > I needed to use the processPath to determine if the user > > don't do the > > > authentification action (it's normal that he is not yet > > > authenticated) and > > > the processActionForward to transfert the user to the login > > > page if he is > > > not connected. > > > > > > Any idea ?? > > > > > > > > > > > > "Martin Cooper" <[EMAIL PROTECTED]> a écrit dans > > > le message de > > > news: [EMAIL PROTECTED] > > > > Depending on why you were subclassing ActionServlet in > > > Struts 1.0.2, you > > > may > > > > find that you don't need to do so in Struts 1.1. Or, you > > > can subclass > > > > RequestProcessor instead, or use a PlugIn to do what you need. > > > > > > > > If you can tell us more about why you needed to subclass in > > > 1.0.2, we > > > should > > > > be able to help you find the right solution for Struts 1.1. > > > > > > > > -- > > > > Martin Cooper > > > > > > > > > > > > > -----Original Message----- > > > > > From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]] > > > > > Sent: Wednesday, July 10, 2002 5:27 AM > > > > > To: Struts Users Mailing List (E-mail) > > > > > Subject: Migration from 1.0.2 to 1.1 > > > > > > > > > > > > > > > In my WebApp using struts 1.0.2 I subclassed the > ActionServlet. > > > > > In this servlet I used the methods processPath() and > > > > > processActionForward() > > > > > from the ActionServlet 1.0.2. > > > > > How can I do with the 1.1 because when I retreive the > > > > > RequestProcessor, > > > > > these methods are protected :-( > > > > > > > > > > Bugzilla ???? > > > > > Arnaud HERITIER > > > > > EAI Consulting > > > > > Sopra Group > > > > > Tél. : +33 (0)1 53 33 44 74 > > > > > email : [EMAIL PROTECTED] > > > > > > > > > > Ce message est exclusivement destiné aux personnes dont le > > > > > nom figure > > > > > ci-dessus. Il peut contenir des informations > > > confidentielles dont la > > > > > divulgation est à ce titre rigoureusement interdite. Dans > > > > > l'hypothèse où > > > > > vous avez reçu ce message par erreur, merci de le > > > renvoyer à l'adresse > > > > > e-mail ci-dessus et de détruire toute copie. > > > > > > > > > > This message may contain confidential and proprietary > > > > > material for the > > > > > sole use of the intended recipient. Any review or > > > > > distribution by others is > > > > > strictly prohibited. If you are not the intended recipient, > > > > > please contact > > > > > the sender and delete all copies. > > > > > > > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands, e-mail: > > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > -- > > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > This transmission (and any information attached to it) may be > confidential and is intended solely for the use of the > individual or entity to which it is addressed. If you are not > the intended recipient or the person responsible for > delivering the transmission to the intended recipient, be > advised that you have received this transmission in error and > that any use, dissemination, forwarding, printing, or copying > of this information is strictly prohibited. If you have > received this transmission in error, please immediately > notify LabOne at (800)388-4675. > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>