Instead of scattering the session/cookie checks throughout your actions, you could make a BaseSecurityCheckAction that does the check and then have the actions which need the checks extend the base action. In Webwork and therefore Struts 2, you'll be able to implement this as an interceptor, and use that interceptor for whatever actions you'd like.
dave On Sat, 2006-04-15 at 06:43 -0700, Jeff Thorne wrote: > Andy, > > Thanks for the response. I not 100% sure the session/cookie checks were > slowing me down. I just had a hunch that there must be a better way > To implement these checks than to scatter them about my jsp and action > classes. > > My site acts like a portal for members and the member home page must > make many DB connections to retrieve their data much similar to a > myYahoo. > > I was thinking that it was the session/cookie checks in combination with > with DB calls that was slowing down access to the member home page. > There is a lot going on my member home page with several transfer objects > Being created and put into the request object. I have been reading that it > May be more efficient to just pass the resultset back to the view rather > Than deal with the overhead of several transfer objects. Does this make > sense? > > Cheers, > Jeff > > > -----Original Message----- > From: Adam Hardy [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 15, 2006 2:41 AM > To: Struts Users Mailing List > Subject: Re: Efficient session object and cookie checks in struts > > Jeff Thorne on 15/04/06 06:19, wrote: > > My struts application maintains 2 small objects in the user's > > session. One is for the users location info (mandatory) and the other > > is the User Object (optional). I also save 2 cookies one being the > > user's location info (mandatory) and the other the user's saved login > > credentials (optional) to maintain the user's information between > > sessions. > > > > When a user returns to my site I need to check for the location and > > User objects in the session. If they are not there I look for the > > cookies to get the information needed to recreate these session > > objects. I need to perform these checks on 90% of my actions and jsp > > pages however I find these checks slowing down my application. What > > would be the most efficient way to provide these checks? Would it be > > to provide the checks in the action base class? > > Hi Jeff, > > if you don't mind me asking, how do you know it is slowing your app > down? To perform these checks should require only an if clause such as > > if (session.getAttribute("bean") == null) > > If you have that in one place, it shouldn't slow anything down. > > In answer to your question though, I would do this in an action base > class and keep the code in one place. If you are using JSPs where you > need the info but you don't go through an action to get there, you could > put it in a filter - or perhaps more simply, make all your paths go > through actions. > > > Adam > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]