At 1:36 PM -0600 2003/01/22, Brad Balmer wrote:
Right now we are using the 2.2 servlet spec which, as far as I know,
doesn't support filters.  (Unless there is another way that I'm
missing).

It's a common pattern to extend org.apache.struts.action.Action into an abstract base action which handles housekeeping. Something like this:


public abstract class BaseAction extends Action
{

public ActionForward execute(mapping,form,req,resp) throws Exception
{
housekeepingMethod();
ActionForward result = doExecute(mapping,form,req,resp);
moreHousekeeping(); // if you need it.
return result;
}

public abstract ActionForward doExecute(mapping,form,req,resp);

}

If you ensure that you only use actions which extend your BaseAction, you've got it all covered. We always extend from a local BaseAction even before we know we need this or any other behavior; the local BaseAction may be empty for a while but it prepares us for the nearly inevitable event that we find some behavior which is convenient to share among multiple actions.

Hope this helps,
Joe



-----Original Message-----
From: Robert Taylor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 22, 2003 1:32 PM
To: Struts Users Mailing List
Subject: RE: Session Affinity Manager

Why not use a filter?

robert

 -----Original Message-----
 From: Brad Balmer [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 22, 2003 2:26 PM
 To: 'Struts Users Mailing List'
 Subject: Session Affinity Manager


 We have multiple web applications running (therefore multiple .war
 files) that share a single .jar file of common business logic and
 database call code.

 In order for the .jar code to know anything about the .war code (for
 logging, etc) I wrote a Session Affinity Manager where the .war code
can
 call SAM.getSAM().setSession(HttpSession session) and the .jar code
can
 call SAM.getSAM().getSession() and get to my session object through a
 ThreadLocal variable.

 Anyway, in my application I need to call the setSession() piece each
 time a request is to be sent to the web server.  Now, I can add this
 code to each and every .jsp and to every Action class, but I was
 wondering if there was any other place that I could do this.

 What I need to call, specifically, for each request (thread) is the
 following:
 HttpSession session = request.getSession(false);
 SAM.getSAM().setSession(session);

 Does anyone know a place in Struts where I can do this?  I initially
 thought of the processActionPerform() function inside the
 RequestProcessor class, but would I have to re-write all of the
existing
code for this function for each of my web applications?

Thanks.


--
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]>

--
--
Joe Germuska | "Big corporations here now believe we will have war.
[EMAIL PROTECTED] | Believe all would welcome it as relief to suspense."
http://blog.germuska.com/ | telegram to President McKinley, 25 March 1898


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to