Hi david

I spent a little to much allocated time on this so I had to move on, and I am 
going to come back to it at a later date. I have a quick 'hack' (a  taglib 
which checks the session in each jsp) for my prototype to present to the 
client......Anyway, when i do it i will let you know.....

What i have found so far though is that by using declarative exception 
handling in my struts-config.xml the error, i think, needs to be thrown from 
a action class. If i could do it from my requestProcessor that would be 
great? I wasnt sure how to configure my app to call processRoles() on evey 
request, so i overrode the locale method as a test as this was been called 
eveytime. However because the locale method dosnt throw any exceptions i 
again ran into problems. So overall what i really would like to do would be 
to extend requestProcessor with my own custom method which throws my own 
exception which will be redirected to the appropriate page and called on 
every request. Sounds easy and probably is to someone who has a better 
understanding of stuts than i do? Anyway wont give up and will let you know 
if you are interested....? Bank holiday this monday!! so a long relaxing 
weekend is due before i crack on with this one ; )

cheers

Andy


On Friday 22 Aug 2003 4:21 pm, you wrote:
> Andy,
>
> Did you get processRoles to work for you?
> How do you redirect to the (error) page of
> your choice in it?
>
> Thanks,
> David
>
> -----Original Message-----
> From: Andy Richards [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 21, 2003 9:55 AM
> To: Struts Users Mailing List
> Subject: Re: login request + ActionServlet RequestProcessor Action
>
>
> Hmm
>
> Strugling a bit with this one now.?? I have extended requestProcessor and
> tried to perform a requestDispatch and responseRedirect, however both fail
> as
> the error message informs me the reponse has already been submitted. I
> thought i may be able to use declarative exception handling with global
> exceptions in the stuts config to redirect the user to my login page (but
> no joy!). Anyone have any ideas? Also what method should i override in the
> RequestProcessor when handling my login?
>
> many thanks
>
> Andy
>
> On Thursday 21 Aug 2003 11:40 am, Kok Wei, Koh wrote:
> > Yeah you should only need to define your custom
> > AuthenticationRequestProcessor class which extends RequestProcessor in
> > controller element of your struts-config.xml.
> >
> > Andy Richards wrote:
> > > Hi Kok
> > >
> > > Good point, never thought about that! One point towards extending the
> > > requestProcessor then, as if i am right i configure this in my
> > > struts-config.xml and dont need to extend it from every action class.
> > >
> > > Thanks
> > >
> > > Andy
> > >
> > > On Thursday 21 Aug 2003 10:26 am, Kok Wei, Koh wrote:
> > >>Hi Andy,
> > >>
> > >>I guess the decision boils down to how your application is going to be
> > >>written. For a project I worked on couple of weeks back, I ran into a
> > >>problem where one of my Actions needs to extend a class to inherit some
> > >>functionality, but I was stucked because I need to extend my
> > >>"AuthenticationAction" which handles all my user login stuff.
> > >>
> > >>I can't extend from 2 classes, right? I then went on to research the
> > >>RequestProcessor. I used tiles of Struts 1.1 in my project so what I
> > >> did was I ported the "AuthenticationAction" code to say
> > >>"AuthenticationRequestProcessor" and it extends "TilesRequestProcessor"
> > >>which extends the Struts "RequestProcessor".
> > >>
> > >>So it all depends on if you're gonna run into problems like this?
> > >>
> > >>My 2 cents. Hope this helps.
> > >>
> > >>Andy Richards wrote:
> > >>>Hi
> > >>>
> > >>>After deciding which approach to take and reading a few of my struts
> > >>>books about the controller object ; ) I am now confused as which is
> > >>> the most appropriate class to extend to perform my login
> > >>> functionality. David suggests extending the base action class,
> > >>> however i have read that the RequestProcessor class was added to
> > >>> struts1.1 to extend the ActionServlet. From what i can see this class
> > >>> handles all requests and one of its methods calls the appropriate
> > >>> action. Therefore which would be the better class to extend 
> > >>> ActionServlet, RequestProcessor or Action. Any ideas.....?
> > >>>
> > >>>thanks
> > >>>
> > >>>Andy
> > >>>
> > >>>On Wednesday 20 Aug 2003 2:41 pm, David G. Friedman wrote:
> > >>>>Dear Andy,
> > >>>>
> > >>>>I'm doing the same thing you suggest.  My approach is
> > >>>>to extend the base Action (or any type of Action) class
> > >>>>by adding a functon 'checkLogin'.  It takes the 'request'
> > >>>>as the argument, checks the session for a User bean, and
> > >>>>throws an exception if the bean is missing or if the ID
> > >>>>number on the bean is zero/unset.  In my execute() method
> > >>>>I make my first line 'checkLogin(request)' and it handles
> > >>>>my authentication.
> > >>>>
> > >>>>If you try this approach, keep in mind I'm using Struts
> > >>>>v1.1 final so I can use exceptions.
> > >>>>
> > >>>>Tonight I'm going to try switching it to an interface so
> > >>>>I can use it to extend any action type by using 3 lines
> > >>>>(and without sub-classing):
> > >>>>
> > >>>>1. import com.mycompany.auth.LoginCheck;
> > >>>>2. public class MyAction extends Action implements LoginCheck
> > >>>>3. checkLogin(request) <--- 1st line from within the execute
> > >>>>or DispatchAction, or LookupDispatchAction method, etc.
> > >>>>
> > >>>>Regards,
> > >>>>David
> > >>>>
> > >>>>-------Original Message-------
> > >>>>From: Andy Richards <[EMAIL PROTECTED]>
> > >>>>Sent: 08/20/03 09:46 AM
> > >>>>To: [EMAIL PROTECTED]
> > >>>>Subject: login request
> > >>>>
> > >>>>>Hi, i have created a form and a action which checks to see if a user
> > >>>>
> > >>>>exists
> > >>>>in
> > >>>>my database and if so a value object is placed into the session. What
>
> i
>
> > >>>>am
> > >>>>
> > >>>>
> > >>>>unsure of is how to a action called everytime a request is made? Can
> > >>>> i configure struts-config.xml to send all requests via an action to
> > >>>> see if this
> > >>>>session object exists, and if not redirect the user to the login
> > >>>> page?
> > >>>>
> > >>>>many thanks
> > >>>>
> > >>>>Andy
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>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]
> >
> > ---------------------------------------------------------------------
> > 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]

-- 
******************************************************
Andy Richards
Application Developer
Winning Moves Ltd
Field House
Mount Road
Stone
Staffordshire
ST15 8LJ
Telephone: +44 (0) 1785 827600
Facsimile: +44 (0) 1785 827601
E Mail: [EMAIL PROTECTED]
Web Site: www.winningmoves.com
Registered in England no. 3069806
******************************************************

This E Mail contains proprietary and confidential information some
or all of which may be legally privileged. It is intended for the
addressee only. If you have received this in error, please notify
the sender immediately and you must not use, disclose, distribute,
copy, print or rely on this E-mail.

The views expressed in this E-mail are those of the author and do
not necessarily reflect the views of Winning Moves Ltd.

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

Reply via email to